aboutsummaryrefslogtreecommitdiff
path: root/node_modules/tools
diff options
context:
space:
mode:
authorArmen Kesablyan2012-05-15 16:34:46 -0700
committerArmen Kesablyan2012-05-15 16:34:46 -0700
commitc8d61c8e72e0eba266575f9df54325fa77fde73d (patch)
tree556cafd76ab9b2cf4cc2b4cc3ea17b12ce690b69 /node_modules/tools
parent15a3aaebb56cb2c9409bfe55c862868726c7fd44 (diff)
parent46bd3712329cd3c9311e50ed9ee4c2245bd1be5a (diff)
downloadninja-c8d61c8e72e0eba266575f9df54325fa77fde73d.tar.gz
Merge branch 'dom-architecture' of github.com:Motorola-Mobility/ninja-internal into binding
Diffstat (limited to 'node_modules/tools')
-rwxr-xr-x[-rw-r--r--]node_modules/tools/template/template-creator.js (renamed from node_modules/tools/template-creator.js)40
1 files changed, 18 insertions, 22 deletions
diff --git a/node_modules/tools/template-creator.js b/node_modules/tools/template/template-creator.js
index e312cd32..1cd65ddd 100644..100755
--- a/node_modules/tools/template-creator.js
+++ b/node_modules/tools/template/template-creator.js
@@ -23,39 +23,38 @@ var TemplateCreator = exports.TemplateCreator = Montage.create(Template, /** @le
23 return this.initWithHeadAndBodyElements(doc.head, doc.body, montageJsPath); 23 return this.initWithHeadAndBodyElements(doc.head, doc.body, montageJsPath);
24 } 24 }
25 }, 25 },
26 26
27 initWithBodyElement: { 27 initWithBodyElement: {
28 value: function(body, montageJsPath) { 28 value: function(body, montageJsPath) {
29 return this.initWithHeadAndBodyElements(null, body, montageJsPath); 29 return this.initWithHeadAndBodyElements(null, body, montageJsPath);
30 } 30 }
31 }, 31 },
32 32
33 initWithHeadAndBodyElements: { 33 initWithHeadAndBodyElements: {
34 value: function(head, body, components, montageJsPath) { 34 value: function(head, body, montageJsPath) {
35 var serializer = this.serializer, 35 var serializer = this.serializer,
36 objects = {}, 36 objects = {},
37 //components = {}, 37 components = {},
38 doc, 38 doc,
39 script, 39 script,
40 self = this; 40 self = this;
41 41
42 this._objectNamesIndex = {}; 42 this._objectNamesIndex = {};
43 //doc = this._document = document.implementation.createHTMLDocument(""); 43 doc = this._document = document.implementation.createHTMLDocument("");
44 44
45 /* 45 function copyNode(sourceNode, targetNode, isRootNode) {
46function copyNode(sourceNode, targetNode, isRootNode) {
47 var childNodes = sourceNode.childNodes, 46 var childNodes = sourceNode.childNodes,
48 childNode, 47 childNode,
49 targetChildNode, 48 targetChildNode,
50 label, 49 label,
51 script, 50 script,
52 component = isRootNode ? null : sourceNode.controller; 51 component = isRootNode ? null : sourceNode.controller;
53 52
54 if (component) { 53 if (component) {
55 label = self._generateLabelForComponent(component); 54 label = self._generateLabelForComponent(component);
56 targetNode.setAttribute("id", label); 55 targetNode.setAttribute("id", label);
57 component._element = targetNode; 56 component._element = targetNode;
58 //components[label] = component; 57 components[label] = component;
59 } else { 58 } else {
60 for (var i = 0; (childNode = childNodes[i]); i++) { 59 for (var i = 0; (childNode = childNodes[i]); i++) {
61 targetChildNode = targetNode.appendChild(childNode.cloneNode(false)); 60 targetChildNode = targetNode.appendChild(childNode.cloneNode(false));
@@ -63,10 +62,8 @@ function copyNode(sourceNode, targetNode, isRootNode) {
63 } 62 }
64 } 63 }
65 } 64 }
66*/ 65
67 66 if (head) {
68 /*
69if (head) {
70 doc.head.innerHTML = head.innerHTML; 67 doc.head.innerHTML = head.innerHTML;
71 } 68 }
72 if (montageJsPath) { 69 if (montageJsPath) {
@@ -75,7 +72,7 @@ if (head) {
75 doc.head.appendChild(script); 72 doc.head.appendChild(script);
76 doc.head.insertBefore(doc.createTextNode("\n "), script); 73 doc.head.insertBefore(doc.createTextNode("\n "), script);
77 } 74 }
78 75
79 // try to make things look nice... 76 // try to make things look nice...
80 var html = doc.documentElement; 77 var html = doc.documentElement;
81 html.insertBefore(doc.createTextNode("\n"), doc.head); 78 html.insertBefore(doc.createTextNode("\n"), doc.head);
@@ -85,20 +82,19 @@ if (head) {
85 // the first child is the title 82 // the first child is the title
86 doc.head.insertBefore(doc.createTextNode("\n "), doc.head.firstChild); 83 doc.head.insertBefore(doc.createTextNode("\n "), doc.head.firstChild);
87 } 84 }
88*/ 85
89 86 copyNode(body, this._document.body, true);
90 //copyNode(body, this._document.body, true);
91 this._ownerSerialization = serializer.serialize(components); 87 this._ownerSerialization = serializer.serialize(components);
92 this._externalObjects = serializer.getExternalObjects(); 88 this._externalObjects = serializer.getExternalObjects();
93 89
94 return this; 90 return this;
95 } 91 }
96 }, 92 },
97 93
98 _componentNamesIndex: { 94 _componentNamesIndex: {
99 value: null 95 value: null
100 }, 96 },
101 97
102 _generateLabelForComponent: {value: function(component) { 98 _generateLabelForComponent: {value: function(component) {
103 var componentInfo = Montage.getInfoForObject(component), 99 var componentInfo = Montage.getInfoForObject(component),
104 componentLabel = componentInfo.label, 100 componentLabel = componentInfo.label,