in asdoc/XML.js [2418:2454]
XML.prototype.replace = function(propertyName, value) {
var /** @type {string} */ ref = this.getNodeRef();
if (ref == XML.TEXT || ref == XML.COMMENT || ref == XML.PROCESSING_INSTRUCTION || ref == XML.ATTRIBUTE) {
return this.XML_s().replace(propertyName, value);
}
if (org.apache.royale.utils.Language.is(value, XML) || org.apache.royale.utils.Language.is(value, XMLList))
value = value.copy();
else
value = value + '';
var /** @type {number} */ idx = (parseInt(propertyName, 10)) >>> 0;
if (idx.toString() == propertyName + '') {
this.replaceChildAt((idx) >> 0, value);
return this;
}
var /** @type {QName} */ n = this.XML_toXMLName(propertyName);
var /** @type {number} */ i = -1;
var /** @type {number} */ k = (this.childrenLength() - 1) >>> 0;
var /** @type {XML} */ replaceChild = null;
for (; k > -1; k--) {
var /** @type {XML} */ childK = this._children[k];
if (((n.localName == "*") || ((childK.getNodeRef() == XML.ELEMENT) && (childK.localName() == n.localName))) && ((n.uri == null) || ((childK.getNodeRef() == XML.ELEMENT) && (childK.name().uri == n.uri)))) {
if (i != -1) {
this.XML_deleteChildAt(i);
this.xml$_notify("nodeRemoved", this, replaceChild, null);
}
i = (k) >> 0;
replaceChild = childK;
}
}
if (i == -1)
return this;
this.XML__internalSuppressNotify = true;
this.replaceChildAt(i, value);
this.XML__internalSuppressNotify = false;
this.xml$_notify("nodeChanged", this, this._children[i], replaceChild);
return this;
};