Added "0", fixes for setChild/setChildren
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/266cf0b0 Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/266cf0b0 Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/266cf0b0 Branch: refs/heads/develop Commit: 266cf0b0d7bc8daea66da5545d409f10fd6db7fc Parents: 5251917 Author: Harbs <[email protected]> Authored: Wed Feb 10 14:56:24 2016 +0200 Committer: Harbs <[email protected]> Committed: Wed Feb 10 14:56:24 2016 +0200 ---------------------------------------------------------------------- frameworks/projects/XML/as/src/XML.as | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/266cf0b0/frameworks/projects/XML/as/src/XML.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/XML/as/src/XML.as b/frameworks/projects/XML/as/src/XML.as index 02faa79..b6abbe9 100644 --- a/frameworks/projects/XML/as/src/XML.as +++ b/frameworks/projects/XML/as/src/XML.as @@ -306,6 +306,15 @@ package // get rid of nodes we do not want //loop through the child nodes and build XML obejcts for each. + Object.defineProperty(this,"0", + { + get: function() { return this; }, + set: function(newValue:*) { + }, + enumerable: true, + configurable: true + } + ); } @@ -1703,15 +1712,17 @@ package len = chldrn.length() -1; for (i= len; i >= 0; i--) { + removeChild(chldrn[i]); // remove the nodes // remove the children // adjust the childIndexes } var curChild = _children[childIdx]; // Now add them in. - for each(chld in elements) + len = elements.length(); + for(i=0;i<len;i++) { - + child = elements[i]; if(!curChild) { curChild = appendChild(chld); @@ -1740,7 +1751,7 @@ package list[0] = value; value = list; } - if(elements is XMLList) + if(value is XMLList) { // remove all existing elements var chldrn:XMLList = this.child(elementName); @@ -1751,15 +1762,17 @@ package len = chldrn.length() -1; for (i= len; i >= 0; i--) { + removeChild(chldrn[i]); // remove the nodes // remove the children // adjust the childIndexes } var curChild = _children[childIdx]; // Now add them in. - for each(chld in elements) + len = value.length(); + for(i=0;i<len;i++) { - + child = value[i]; if(!curChild) { curChild = appendChild(chld);
