You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ah...@apache.org on 2014/10/31 23:08:44 UTC

[09/14] git commit: [flex-asjs] [refs/heads/develop] - fix id handling on objects

fix id handling on objects


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

Branch: refs/heads/develop
Commit: ea9803cfcd70742743de373e368153706c92518d
Parents: 7340650
Author: Alex Harui <ah...@apache.org>
Authored: Fri Oct 31 14:22:39 2014 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Fri Oct 31 15:08:15 2014 -0700

----------------------------------------------------------------------
 .../apache/flex/utils/MXMLDataInterpreter.as    | 23 ++++++++++++++------
 1 file changed, 16 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ea9803cf/frameworks/as/projects/FlexJSUI/src/org/apache/flex/utils/MXMLDataInterpreter.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/utils/MXMLDataInterpreter.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/utils/MXMLDataInterpreter.as
index ef3d3e4..7b2982d 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/utils/MXMLDataInterpreter.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/utils/MXMLDataInterpreter.as
@@ -97,18 +97,27 @@ public class MXMLDataInterpreter
                 else if (simple == false)
                     value = generateMXMLObject(document, value as Array);
                 if (name == "id")
-                {
-                    document[value] = comp;
                     id = value as String;
-                }
+                if (name == "document" && !comp.document)
+                    comp.document = document;
                 else if (name == "_id")
+                    id = value as String; // and don't assign to comp
+                else if (name == "id")
                 {
-                    document[value] = comp;
-                    id = value as String;
-                    continue; // skip assignment to comp
+                    // not all objects have to have their own id property
+                    try {
+                        comp["id"] = value;
+                    } catch (e:Error)
+                    {
+                        
+                    }
                 }
-                comp[name] = value;
+                else
+                    comp[name] = value;
             }
+            if (id)
+                document[id] = comp;
+
             if (comp is IDocument)
                 comp.setDocument(document, id);
         }