You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ha...@apache.org on 2016/04/11 00:48:26 UTC

[15/49] git commit: [flex-asjs] [refs/heads/develop] - Added "0", fixes for setChild/setChildren

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 <ha...@in-tools.com>
Authored: Wed Feb 10 14:56:24 2016 +0200
Committer: Harbs <ha...@in-tools.com>
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);