diff options
author | Nivesh Rajbhandari | 2012-05-04 15:33:29 -0700 |
---|---|---|
committer | Nivesh Rajbhandari | 2012-05-04 15:33:29 -0700 |
commit | ad94ec51c81badeba2b0f870cad8a0eec7878ebd (patch) | |
tree | 35c52d44d2c5399ea4019582af3fb55a53ee05c8 /node_modules/montage/core | |
parent | 3ad9024bcfce76e28816daa02bac14fc8985ca62 (diff) | |
parent | 3ebed34665fa73b0ce613b400f3029ebf4476439 (diff) | |
download | ninja-ad94ec51c81badeba2b0f870cad8a0eec7878ebd.tar.gz |
Merge branch 'refs/heads/dom-architecture-master' into Dom-Architecture
Diffstat (limited to 'node_modules/montage/core')
-rwxr-xr-x | node_modules/montage/core/deserializer.js | 14 | ||||
-rwxr-xr-x | node_modules/montage/core/event/event-manager.js | 28 | ||||
-rwxr-xr-x | node_modules/montage/core/logger.js | 2 | ||||
-rwxr-xr-x | node_modules/montage/core/serializer.js | 18 |
4 files changed, 13 insertions, 49 deletions
diff --git a/node_modules/montage/core/deserializer.js b/node_modules/montage/core/deserializer.js index b8ed5618..c1c97b2b 100755 --- a/node_modules/montage/core/deserializer.js +++ b/node_modules/montage/core/deserializer.js | |||
@@ -332,11 +332,6 @@ var Deserializer = Montage.create(Montage, /** @lends module:montage/core/deseri | |||
332 | @param {Array} properties The property names to be deserialized. | 332 | @param {Array} properties The property names to be deserialized. |
333 | */ | 333 | */ |
334 | deserializePropertiesForObject: {value: function(object, properties) { | 334 | deserializePropertiesForObject: {value: function(object, properties) { |
335 | // TODO: ensure backward compatibility | ||
336 | if (properties && "childComponents" in properties) { | ||
337 | properties.childComponents = []; | ||
338 | console.log('Warning: "childComponents" isn\'t supported on components within the current serializaation format, this property will be reset to [].'); | ||
339 | } | ||
340 | for (var key in properties) { | 335 | for (var key in properties) { |
341 | object[key] = properties[key]; | 336 | object[key] = properties[key]; |
342 | } | 337 | } |
@@ -846,8 +841,7 @@ var Deserializer = Montage.create(Montage, /** @lends module:montage/core/deseri | |||
846 | if (id) { | 841 | if (id) { |
847 | return 'element.getElementById("' + id + '")'; | 842 | return 'element.getElementById("' + id + '")'; |
848 | } else { | 843 | } else { |
849 | // TODO: getElemenyById only here for backwards compatibility | 844 | return 'element.querySelector(\'*[' + Deserializer._MONTAGE_ID_ATTRIBUTE + '="' + value + '"]\')'; |
850 | return 'element.querySelector(\'*[' + Deserializer._MONTAGE_ID_ATTRIBUTE + '="' + value + '"]\') || element.getElementById("' + value + '")'; | ||
851 | } | 845 | } |
852 | break; | 846 | break; |
853 | 847 | ||
@@ -859,7 +853,8 @@ var Deserializer = Montage.create(Montage, /** @lends module:montage/core/deseri | |||
859 | break; | 853 | break; |
860 | 854 | ||
861 | case "reference": | 855 | case "reference": |
862 | var object; | 856 | var object, |
857 | originalValue = value; | ||
863 | 858 | ||
864 | if (value in exports) { | 859 | if (value in exports) { |
865 | object = exports[value]; | 860 | object = exports[value]; |
@@ -874,6 +869,9 @@ var Deserializer = Montage.create(Montage, /** @lends module:montage/core/deseri | |||
874 | if (parent) { | 869 | if (parent) { |
875 | parent[key] = object; | 870 | parent[key] = object; |
876 | } | 871 | } |
872 | if (typeof object === "undefined") { | ||
873 | logger.error("Missing object in serialization: '" + originalValue + "'" + (self._origin ? " in " + self._origin : "")); | ||
874 | } | ||
877 | return value; | 875 | return value; |
878 | break; | 876 | break; |
879 | 877 | ||
diff --git a/node_modules/montage/core/event/event-manager.js b/node_modules/montage/core/event/event-manager.js index 75272f85..d38b9755 100755 --- a/node_modules/montage/core/event/event-manager.js +++ b/node_modules/montage/core/event/event-manager.js | |||
@@ -332,29 +332,6 @@ var EventManager = exports.EventManager = Montage.create(Montage,/** @lends modu | |||
332 | this._application = application; | 332 | this._application = application; |
333 | } | 333 | } |
334 | }, | 334 | }, |
335 | /** | ||
336 | @function | ||
337 | @param {String} composer Event composer. | ||
338 | @param {Array} eventType Event type array. | ||
339 | */ | ||
340 | registerComposer_forEventType_: { | ||
341 | enumerable: false, | ||
342 | value: function(composer, eventType) { | ||
343 | |||
344 | if (!!this._registeredEventComposers[eventType]) { | ||
345 | throw "Cannot register composer for eventType:" + eventType + ". Already have one registered."; | ||
346 | } | ||
347 | |||
348 | this._registeredEventComposers[eventType] = composer; | ||
349 | } | ||
350 | }, | ||
351 | /** | ||
352 | @private | ||
353 | */ | ||
354 | _registeredEventComposers: { | ||
355 | value: {}, | ||
356 | enumerable: false | ||
357 | }, | ||
358 | 335 | ||
359 | // Dictionary keyed by event types with the collection of handlers per event type | 336 | // Dictionary keyed by event types with the collection of handlers per event type |
360 | // This dictates why the event manager observes events of a particular type | 337 | // This dictates why the event manager observes events of a particular type |
@@ -718,12 +695,7 @@ var EventManager = exports.EventManager = Montage.create(Montage,/** @lends modu | |||
718 | 695 | ||
719 | } | 696 | } |
720 | 697 | ||
721 | // Inform any composers about this request if we need to synthesize this eventType | ||
722 | if (isNewTarget && typeof target.nativeAddEventListener === "function") { | 698 | if (isNewTarget && typeof target.nativeAddEventListener === "function") { |
723 | if (this._registeredEventComposers[eventType]) { | ||
724 | this._registeredEventComposers[eventType].startObservingTarget_forEventType_(target, eventType); | ||
725 | } | ||
726 | |||
727 | this._observeTarget_forEventType_(target, eventType); | 699 | this._observeTarget_forEventType_(target, eventType); |
728 | } | 700 | } |
729 | 701 | ||
diff --git a/node_modules/montage/core/logger.js b/node_modules/montage/core/logger.js index 26094e76..434aa4dd 100755 --- a/node_modules/montage/core/logger.js +++ b/node_modules/montage/core/logger.js | |||
@@ -408,7 +408,7 @@ LoggerUI = Montage.create(Montage, /** @lends module:montage/core/logger.LoggerU | |||
408 | //YUCK!! I wish I could use a reel!!! | 408 | //YUCK!! I wish I could use a reel!!! |
409 | var styleTest = "#_montage_logger_inspector {"; | 409 | var styleTest = "#_montage_logger_inspector {"; |
410 | styleTest += " border: 1px solid rgba(15,15,15,0.4);"; | 410 | styleTest += " border: 1px solid rgba(15,15,15,0.4);"; |
411 | styleTest += " position: absolute;"; | 411 | styleTest += " position: fixed;"; |
412 | styleTest += " right: 25px;"; | 412 | styleTest += " right: 25px;"; |
413 | styleTest += " top: 25px;"; | 413 | styleTest += " top: 25px;"; |
414 | styleTest += " -webkit-border-radius: 5px;"; | 414 | styleTest += " -webkit-border-radius: 5px;"; |
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 | ||