XML.prototype.removeNamespace = function()

in asdoc/XML.js [2371:2402]


XML.prototype.removeNamespace = function(ns) {
  var /** @type {number} */ i = 0;
  var /** @type {number} */ len = 0;
  //var /** @type {number} */ i = 0;
  //var /** @type {number} */ len = 0;
  var /** @type {string} */ ref = this.getNodeRef();
  if (ref == XML.TEXT || ref == XML.COMMENT || ref == XML.PROCESSING_INSTRUCTION || ref == XML.ATTRIBUTE)
    return this;
  if (!org.apache.royale.utils.Language.is(ns, Namespace))
    ns = new Namespace(ns);
  if (ns == this.name().getNamespace(this._namespaces))
    return this;
  len = this.attributeLength();
  for (i = 0; i < len; i++) {
    if (ns == this._attributes[i].name().getNamespace(this._namespaces))
      return this;
  }
  len = this.namespaceLength();
  for (i = (len - 1) >> 0; i >= 0; i--) {
    if (this._namespaces[i].uri == ns.uri && this._namespaces[i].prefix == ns.prefix)
      this._namespaces.splice(i, 1);
    else if (ns.prefix == null && this._namespaces[i].uri == ns.uri)
      this._namespaces.splice(i, 1);
  }
  len = this.childrenLength();
  for (i = 0; i < len; i++) {
    if (this._children[i].getNodeRef() == XML.ELEMENT)
      this._children[i].removeNamespace(ns);
  }
  this.xml$_notify("namespaceRemoved", this, ns, null);
  return this;
};