From 87a5999ecd9e7d84d21fd8c712944cd9408c3aa0 Mon Sep 17 00:00:00 2001 From: António Afonso Date: Wed, 30 May 2012 10:36:59 -0700 Subject: Stop serializing the child components of the top components are not serialized We just removed them before serializing and add them again afterwards.--- node_modules/tools/template/template-creator.js | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'node_modules/tools/template/template-creator.js') 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 var serializer = this.serializer, objects = {}, components = {}, + componentsChildComponents = {}, doc, script, self = this; @@ -54,6 +55,8 @@ var TemplateCreator = exports.TemplateCreator = Montage.create(Template, /** @le label = self._generateLabelForComponent(component, Object.keys(components)); component._element = targetNode; components[label] = component; + componentsChildComponents[label] = component.childComponents; + delete component.childComponents; } else { for (var i = 0; (childNode = childNodes[i]); i++) { targetChildNode = targetNode.appendChild(childNode.cloneNode(false)); @@ -84,6 +87,10 @@ var TemplateCreator = exports.TemplateCreator = Montage.create(Template, /** @le copyNode(body, this._document.body, true); this._ownerSerialization = serializer.serialize(components); + for (var label in components) { + components[label].childComponents = componentsChildComponents[label]; + } + components = componentsChildComponents = null; this._externalObjects = serializer.getExternalObjects(); return this; -- cgit v1.2.3