aboutsummaryrefslogtreecommitdiff
path: root/node_modules/tools/template
diff options
context:
space:
mode:
authorAntónio Afonso2012-05-30 10:36:59 -0700
committerAntónio Afonso2012-05-30 10:36:59 -0700
commit87a5999ecd9e7d84d21fd8c712944cd9408c3aa0 (patch)
treeb8cd582a9281de7e2adc113150ec8f426718d3b8 /node_modules/tools/template
parente6dbd73e80ac47ae9bfdfdb5bef3263b24a36603 (diff)
downloadninja-87a5999ecd9e7d84d21fd8c712944cd9408c3aa0.tar.gz
Stop serializing the child components of the top components are not serialized
We just removed them before serializing and add them again afterwards.
Diffstat (limited to 'node_modules/tools/template')
-rwxr-xr-xnode_modules/tools/template/template-creator.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/node_modules/tools/template/template-creator.js b/node_modules/tools/template/template-creator.js
index 4ba1b443..01a2518b 100755
--- a/node_modules/tools/template/template-creator.js
+++ b/node_modules/tools/template/template-creator.js
@@ -35,6 +35,7 @@ var TemplateCreator = exports.TemplateCreator = Montage.create(Template, /** @le
35 var serializer = this.serializer, 35 var serializer = this.serializer,
36 objects = {}, 36 objects = {},
37 components = {}, 37 components = {},
38 componentsChildComponents = {},
38 doc, 39 doc,
39 script, 40 script,
40 self = this; 41 self = this;
@@ -54,6 +55,8 @@ var TemplateCreator = exports.TemplateCreator = Montage.create(Template, /** @le
54 label = self._generateLabelForComponent(component, Object.keys(components)); 55 label = self._generateLabelForComponent(component, Object.keys(components));
55 component._element = targetNode; 56 component._element = targetNode;
56 components[label] = component; 57 components[label] = component;
58 componentsChildComponents[label] = component.childComponents;
59 delete component.childComponents;
57 } else { 60 } else {
58 for (var i = 0; (childNode = childNodes[i]); i++) { 61 for (var i = 0; (childNode = childNodes[i]); i++) {
59 targetChildNode = targetNode.appendChild(childNode.cloneNode(false)); 62 targetChildNode = targetNode.appendChild(childNode.cloneNode(false));
@@ -84,6 +87,10 @@ var TemplateCreator = exports.TemplateCreator = Montage.create(Template, /** @le
84 87
85 copyNode(body, this._document.body, true); 88 copyNode(body, this._document.body, true);
86 this._ownerSerialization = serializer.serialize(components); 89 this._ownerSerialization = serializer.serialize(components);
90 for (var label in components) {
91 components[label].childComponents = componentsChildComponents[label];
92 }
93 components = componentsChildComponents = null;
87 this._externalObjects = serializer.getExternalObjects(); 94 this._externalObjects = serializer.getExternalObjects();
88 95
89 return this; 96 return this;