Repository: flex-asjs
Updated Branches:
  refs/heads/tlf e757350c7 -> 244cd2f8e


Another optimization for XML


Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/244cd2f8
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/244cd2f8
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/244cd2f8

Branch: refs/heads/tlf
Commit: 244cd2f8ebd214b0d26c5b9958cb603e4a4aa647
Parents: e757350
Author: Harbs <[email protected]>
Authored: Mon May 8 12:45:39 2017 +0300
Committer: Harbs <[email protected]>
Committed: Mon May 8 12:45:39 2017 +0300

----------------------------------------------------------------------
 frameworks/projects/XML/src/main/flex/XML.as | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/244cd2f8/frameworks/projects/XML/src/main/flex/XML.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/XML/src/main/flex/XML.as 
b/frameworks/projects/XML/src/main/flex/XML.as
index 3ee0079..efd1756 100644
--- a/frameworks/projects/XML/src/main/flex/XML.as
+++ b/frameworks/projects/XML/src/main/flex/XML.as
@@ -150,7 +150,7 @@ package
                        xml.setNodeKind("attribute");
                        xml.setName(att.name);
                        xml.setValue(att.value);
-                       parent.addChild(xml);
+                       parent.addChildInternal(xml);
                        return xml;
                }
                static private function 
iterateElement(node:Element,xml:XML):void
@@ -170,7 +170,7 @@ package
                        for(i=0;i<len;i++)
                        {
                                var child:XML = fromNode(childNodes[i]);
-                               xml.addChild(child);
+                               xml.addChildInternal(child);
                        }
                }
                /**
@@ -389,6 +389,11 @@ package
                        if(!child)
                                return;
                        
+                       addChildInternal(child);
+                       normalize();
+               }
+               private function addChildInternal(child:XML):void
+               {
                        child.setParent(this);
                        if(child.nodeKind() =="attribute")
                        {
@@ -400,7 +405,6 @@ package
                        }
                        else
                                _children.push(child);
-                       normalize();
                }
 
 
@@ -732,10 +736,10 @@ package
                        }
                        //parent should be null by default
                        for(i=0;i<_attributes.length;i++)
-                               xml.addChild(_attributes[i].copy());
+                               xml.addChildInternal(_attributes[i].copy());
 
                        for(i=0;i<_children.length;i++)
-                               xml.addChild(_children[i].copy());
+                               xml.addChildInternal(_children[i].copy());
                        
                        return xml;
                }

Reply via email to