diff options
Diffstat (limited to 'node_modules/montage/core/serializer.js')
-rwxr-xr-x | node_modules/montage/core/serializer.js | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/node_modules/montage/core/serializer.js b/node_modules/montage/core/serializer.js index 74080770..ba2fa04a 100755 --- a/node_modules/montage/core/serializer.js +++ b/node_modules/montage/core/serializer.js | |||
@@ -458,6 +458,10 @@ var Serializer = Montage.create(Montage, /** @lends module:montage/serializer.Se | |||
458 | serializedUnits = {}; | 458 | serializedUnits = {}; |
459 | objectInfo = Montage.getInfoForObject(object); | 459 | objectInfo = Montage.getInfoForObject(object); |
460 | 460 | ||
461 | if (!this._require) { | ||
462 | throw new Error("Cannot serialize Montage objects without a require function to identify the corresponding package."); | ||
463 | } | ||
464 | |||
461 | moduleId = this._require.identify( | 465 | moduleId = this._require.identify( |
462 | objectInfo.moduleId, | 466 | objectInfo.moduleId, |
463 | objectInfo.require | 467 | objectInfo.require |
@@ -491,15 +495,6 @@ var Serializer = Montage.create(Montage, /** @lends module:montage/serializer.Se | |||
491 | if (!properties) { | 495 | if (!properties) { |
492 | properties = object; | 496 | properties = object; |
493 | propertyNames = Montage.getSerializablePropertyNames(object); | 497 | propertyNames = Montage.getSerializablePropertyNames(object); |
494 | // HACK: only to be able to live together with serialization v1, remover after | ||
495 | var ix; | ||
496 | if ((ix = propertyNames.indexOf("_bindingDescriptors")) > -1) { | ||
497 | propertyNames.splice(ix, 1); | ||
498 | } | ||
499 | if ((ix = propertyNames.indexOf("_eventListenerDescriptors")) > -1) { | ||
500 | propertyNames.splice(ix, 1); | ||
501 | } | ||
502 | // end HACK | ||
503 | } | 498 | } |
504 | serializedUnits.properties = this._serializeObjectLiteral(properties, propertyNames, 3); | 499 | serializedUnits.properties = this._serializeObjectLiteral(properties, propertyNames, 3); |
505 | } | 500 | } |
@@ -572,14 +567,13 @@ var Serializer = Montage.create(Montage, /** @lends module:montage/serializer.Se | |||
572 | */ | 567 | */ |
573 | _serializeElement: {value: function(element) { | 568 | _serializeElement: {value: function(element) { |
574 | var attribute = element.getAttribute(this._MONTAGE_ID_ATTRIBUTE), | 569 | var attribute = element.getAttribute(this._MONTAGE_ID_ATTRIBUTE), |
575 | // TODO: element.id only here for backwards compatibility | 570 | id = attribute; |
576 | id = attribute || element.id; | ||
577 | 571 | ||
578 | if (id) { | 572 | if (id) { |
579 | this._externalElements.push(element); | 573 | this._externalElements.push(element); |
580 | return '{"#":"' + id + '"}'; | 574 | return '{"#":"' + id + '"}'; |
581 | } else { | 575 | } else { |
582 | logger.error("Error: Not possible to serialize a DOM element with no id assigned: " + element.outerHTML); | 576 | logger.error("Error: Not possible to serialize a DOM element with no " + this._MONTAGE_ID_ATTRIBUTE + " assigned: " + element.outerHTML); |
583 | } | 577 | } |
584 | }}, | 578 | }}, |
585 | 579 | ||