diff options
Diffstat (limited to 'node_modules/montage/core/core.js')
-rwxr-xr-x | node_modules/montage/core/core.js | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/node_modules/montage/core/core.js b/node_modules/montage/core/core.js index b665f591..8c1f4249 100755 --- a/node_modules/montage/core/core.js +++ b/node_modules/montage/core/core.js | |||
@@ -788,7 +788,8 @@ Description | |||
788 | */ | 788 | */ |
789 | Object.defineProperty(Object.prototype, "setProperty", { | 789 | Object.defineProperty(Object.prototype, "setProperty", { |
790 | value: function(aPropertyPath, value) { | 790 | value: function(aPropertyPath, value) { |
791 | var lastDotIndex = aPropertyPath.lastIndexOf("."), | 791 | var propertyIsNumber = !isNaN(aPropertyPath), |
792 | lastDotIndex = propertyIsNumber ? -1 : aPropertyPath.lastIndexOf("."), | ||
792 | setObject, | 793 | setObject, |
793 | lastObjectAtPath, | 794 | lastObjectAtPath, |
794 | propertyToSetOnArray; | 795 | propertyToSetOnArray; |
@@ -883,9 +884,10 @@ Object.defineProperty(Array.prototype, "getProperty", { | |||
883 | currentIndex = currentIndex || 0; | 884 | currentIndex = currentIndex || 0; |
884 | 885 | ||
885 | var result, | 886 | var result, |
886 | parenthesisStartIndex = aPropertyPath.indexOf("(", currentIndex), | 887 | propertyIsNumber = !isNaN(aPropertyPath), |
887 | parenthesisEndIndex = aPropertyPath.lastIndexOf(")"), | 888 | parenthesisStartIndex = propertyIsNumber ? -1 : aPropertyPath.indexOf("(", currentIndex), |
888 | currentPathComponentEndIndex = aPropertyPath.indexOf(".", currentIndex), | 889 | parenthesisEndIndex = propertyIsNumber ? -1 : aPropertyPath.lastIndexOf(")"), |
890 | currentPathComponentEndIndex = propertyIsNumber ? -1 : aPropertyPath.indexOf(".", currentIndex), | ||
889 | nextDelimiterIndex = -1, | 891 | nextDelimiterIndex = -1, |
890 | itemResult, | 892 | itemResult, |
891 | index, | 893 | index, |
@@ -917,7 +919,7 @@ Object.defineProperty(Array.prototype, "getProperty", { | |||
917 | } | 919 | } |
918 | 920 | ||
919 | // Find the component of the propertyPath we want to deal with during this particular invocation of this function | 921 | // Find the component of the propertyPath we want to deal with during this particular invocation of this function |
920 | currentPathComponent = aPropertyPath.substring(currentIndex, (nextDelimiterIndex === -1 ? aPropertyPath.length : nextDelimiterIndex)); | 922 | currentPathComponent = propertyIsNumber ? aPropertyPath : aPropertyPath.substring(currentIndex, (nextDelimiterIndex === -1 ? aPropertyPath.length : nextDelimiterIndex)); |
921 | 923 | ||
922 | // EVALUATE: Determine the value of the currentPathComponent | 924 | // EVALUATE: Determine the value of the currentPathComponent |
923 | 925 | ||
@@ -1115,8 +1117,14 @@ Object.defineProperty(Object.prototype, "parentProperty", { | |||
1115 | writable: true | 1117 | writable: true |
1116 | }); | 1118 | }); |
1117 | 1119 | ||
1118 | var EventManager = require("core/event/event-manager").EventManager; | 1120 | // XXX Does not presently function server-side |
1119 | EventManager.create().initWithWindow(window); | 1121 | if (typeof window !== "undefined") { |
1122 | |||
1123 | var EventManager = require("core/event/event-manager").EventManager; | ||
1124 | EventManager.create().initWithWindow(window); | ||
1125 | |||
1126 | // Now that we have a defaultEventManager we can setup the bindings system | ||
1127 | require("core/event/binding"); | ||
1128 | |||
1129 | } | ||
1120 | 1130 | ||
1121 | // Now that we have a defaultEventManager we can setup the bindings system | ||
1122 | require("core/event/binding"); | ||