aboutsummaryrefslogtreecommitdiff
path: root/node_modules/montage
diff options
context:
space:
mode:
authorEric Guzman2012-05-25 16:34:21 -0700
committerEric Guzman2012-05-25 16:34:21 -0700
commit2c1aec1f4d7b2ca03cb9911feeb8a9d1d66f9826 (patch)
treeffbf2f08a892877b31e0dfc35ae26c138e4738de /node_modules/montage
parentd38aaadda934c6ec92df565c86fd5bc6316ae6b4 (diff)
downloadninja-2c1aec1f4d7b2ca03cb9911feeb8a9d1d66f9826.tar.gz
Data Binding - Hacked patch to Montage to enable serialization of dynamically bound objects.
We should remove this once montage github issue [gh-657] is in our version of montage.
Diffstat (limited to 'node_modules/montage')
-rwxr-xr-xnode_modules/montage/core/event/binding.js24
1 files changed, 23 insertions, 1 deletions
diff --git a/node_modules/montage/core/event/binding.js b/node_modules/montage/core/event/binding.js
index 2e226372..c10c52e4 100755
--- a/node_modules/montage/core/event/binding.js
+++ b/node_modules/montage/core/event/binding.js
@@ -343,9 +343,31 @@ var BindingDescriptor = exports.BindingDescriptor = Montage.create(Montage, /**
343}); 343});
344 344
345Serializer.defineSerializationUnit("bindings", function(object) { 345Serializer.defineSerializationUnit("bindings", function(object) {
346 var bindingDescriptors = object._bindingDescriptors; 346 var bindingDescriptors = object._bindingDescriptors,
347 bindingDescriptorsCopy;
348
349 // TODO: Hacked this function to create copy of object literal
350 // TODO: Remove when montage finds out how to identify object literals
351 // TODO: in a different way
352 function cloneObject(object, level) {
353 var clone = {};
354
355 for (var key in object) {
356 if (level > 0) {
357 clone[key] = cloneObject(object[key], level - 1);
358 } else {
359 clone[key] = object[key];
360 }
361 }
362
363 return clone;
364 }
347 365
348 if (bindingDescriptors) { 366 if (bindingDescriptors) {
367 if (Object.getPrototypeOf(bindingDescriptors) !== Object.prototype) {
368 bindingDescriptors = cloneObject(bindingDescriptors , 1);
369 }
370
349 return bindingDescriptors; 371 return bindingDescriptors;
350 } 372 }
351}); 373});