diff options
author | Armen Kesablyan | 2012-05-31 22:05:33 -0700 |
---|---|---|
committer | Armen Kesablyan | 2012-05-31 22:05:33 -0700 |
commit | 50ea77b261e1b3676aea2b1ed582d5e6c97a0997 (patch) | |
tree | fd317d8de8eaec728376c60273b1f6a214816e8e /node_modules/montage/core/event/binding.js | |
parent | b7e33c16bab26f8ee0daa61f920cfdbcb7abc6e3 (diff) | |
parent | 04ef4ffcfde762a0aead4a7b702f3c019fdbeb69 (diff) | |
download | ninja-50ea77b261e1b3676aea2b1ed582d5e6c97a0997.tar.gz |
Merge pull request #4 from ericguzman/binding
Binding
Diffstat (limited to 'node_modules/montage/core/event/binding.js')
-rwxr-xr-x | node_modules/montage/core/event/binding.js | 24 |
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 | ||
345 | Serializer.defineSerializationUnit("bindings", function(object) { | 345 | Serializer.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 | }); |