diff options
Diffstat (limited to 'node_modules/montage/core/event')
-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 c31ee7f9..4206e1c2 100755 --- a/node_modules/montage/core/event/binding.js +++ b/node_modules/montage/core/event/binding.js | |||
@@ -257,9 +257,31 @@ var BindingDescriptor = exports.BindingDescriptor = Montage.create(Montage, /** | |||
257 | }); | 257 | }); |
258 | 258 | ||
259 | Serializer.defineSerializationUnit("bindings", function(object) { | 259 | Serializer.defineSerializationUnit("bindings", function(object) { |
260 | var bindingDescriptors = object._bindingDescriptors; | 260 | var bindingDescriptors = object._bindingDescriptors, |
261 | bindingDescriptorsCopy; | ||
262 | |||
263 | // TODO: Hacked this function to create copy of object literal | ||
264 | // TODO: Remove when montage finds out how to identify object literals | ||
265 | // TODO: in a different way | ||
266 | function cloneObject(object, level) { | ||
267 | var clone = {}; | ||
268 | |||
269 | for (var key in object) { | ||
270 | if (level > 0) { | ||
271 | clone[key] = cloneObject(object[key], level - 1); | ||
272 | } else { | ||
273 | clone[key] = object[key]; | ||
274 | } | ||
275 | } | ||
276 | |||
277 | return clone; | ||
278 | } | ||
261 | 279 | ||
262 | if (bindingDescriptors) { | 280 | if (bindingDescriptors) { |
281 | if (Object.getPrototypeOf(bindingDescriptors) !== Object.prototype) { | ||
282 | bindingDescriptors = cloneObject(bindingDescriptors , 1); | ||
283 | } | ||
284 | |||
263 | return bindingDescriptors; | 285 | return bindingDescriptors; |
264 | } | 286 | } |
265 | }); | 287 | }); |