docs: function (elem)
      {
          var nsMatch;
          var from = null;
  
          if (this.options.matchBare) {
              from = Strophe.getBareJidFromJid(elem.getAttribute('from'));
          } else {
              from = elem.getAttribute('from');
          }
  
          nsMatch = false;
          if (!this.ns) {
              nsMatch = true;
          } else {
              var that = this;
              Strophe.forEachChild(elem, null, function (elem) {
                  if (elem.getAttribute("xmlns") == that.ns) {
                      nsMatch = true;
                  }
              });
  
              nsMatch = nsMatch || elem.getAttribute("xmlns") == this.ns;
          }
  
          var elem_type = elem.getAttribute("type");
          if (nsMatch &&
              (!this.name || Strophe.isTagEqual(elem, this.name)) &&
              (!this.type || (Array.isArray(this.type) ? this.type.indexOf(elem_type) != -1 : elem_type == this.type)) &&
              (!this.id || elem.getAttribute("id") == this.id) &&
              (!this.from || from == this.from)) {
                  return true;
          }
  
          return false;
      }