diff options
Diffstat (limited to 'node_modules')
-rwxr-xr-x | node_modules/montage/core/event/binding.js | 24 | ||||
-rwxr-xr-x | node_modules/montage/core/serializer.js | 4 | ||||
-rwxr-xr-x | node_modules/montage/ui/application.js | 3 |
3 files changed, 28 insertions, 3 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 | }); |
diff --git a/node_modules/montage/core/serializer.js b/node_modules/montage/core/serializer.js index 72543328..deadbc68 100755 --- a/node_modules/montage/core/serializer.js +++ b/node_modules/montage/core/serializer.js | |||
@@ -529,10 +529,10 @@ var Serializer = Montage.create(Montage, /** @lends module:montage/serializer.Se | |||
529 | return this._serializeElement(value); | 529 | return this._serializeElement(value); |
530 | } else if (Array.isArray(value)) { | 530 | } else if (Array.isArray(value)) { |
531 | return this._serializeArray(value, indent + 1); | 531 | return this._serializeArray(value, indent + 1); |
532 | } else if (Object.getPrototypeOf(value) === Object.prototype) { | ||
533 | return this._serializeObjectLiteral(value, null, indent + 1); | ||
534 | } else if (value.constructor === Function) { | 532 | } else if (value.constructor === Function) { |
535 | return this._serializeFunction(value, indent); | 533 | return this._serializeFunction(value, indent); |
534 | } else if (!("getInfoForObject" in value)) { // we consider object literals the ones who aren't a Montage object | ||
535 | return this._serializeObjectLiteral(value, null, indent + 1); | ||
536 | } else { | 536 | } else { |
537 | // TODO: should refactor this to handle references here, doesn't make | 537 | // TODO: should refactor this to handle references here, doesn't make |
538 | // sense to wait until it hits _serializeObject for that to happen | 538 | // sense to wait until it hits _serializeObject for that to happen |
diff --git a/node_modules/montage/ui/application.js b/node_modules/montage/ui/application.js index bbce6835..43443ecc 100755 --- a/node_modules/montage/ui/application.js +++ b/node_modules/montage/ui/application.js | |||
@@ -153,6 +153,9 @@ var Application = exports.Application = Montage.create(Montage, /** @lends monta | |||
153 | // assign to the exports so that it is available in the deserialization of the template | 153 | // assign to the exports so that it is available in the deserialization of the template |
154 | exports.application = self; | 154 | exports.application = self; |
155 | 155 | ||
156 | ///// TODO: Remove this hack when montage exposes this | ||
157 | this._template = template; | ||
158 | |||
156 | template.instantiateWithOwnerAndDocument(null, window.document, function() { | 159 | template.instantiateWithOwnerAndDocument(null, window.document, function() { |
157 | require("ui/component").__root__.needsDraw = true; | 160 | require("ui/component").__root__.needsDraw = true; |
158 | if (callback) { | 161 | if (callback) { |