diff options
Diffstat (limited to 'js/document/mediators')
-rwxr-xr-x | js/document/mediators/template.js | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/js/document/mediators/template.js b/js/document/mediators/template.js index 50fad1c3..e770e07f 100755 --- a/js/document/mediators/template.js +++ b/js/document/mediators/template.js | |||
@@ -145,6 +145,14 @@ exports.TemplateDocumentMediator = Montage.create(Component, { | |||
145 | template.file.content.document.body.setAttribute(template.body.attributes[n].name, template.body.attributes[n].value); | 145 | template.file.content.document.body.setAttribute(template.body.attributes[n].name, template.body.attributes[n].value); |
146 | } | 146 | } |
147 | } | 147 | } |
148 | // | ||
149 | if (template.body && template.body.getAttribute('data-ninja-style') !== null) { | ||
150 | template.file.content.document.body.setAttribute('style', template.body.getAttribute('data-ninja-style')); | ||
151 | template.file.content.document.body.removeAttribute('data-ninja-style'); | ||
152 | } else if (template.body && template.body.getAttribute('data-ninja-style') === null) { | ||
153 | template.file.content.document.body.removeAttribute('style'); | ||
154 | template.file.content.document.body.removeAttribute('data-ninja-style'); | ||
155 | } | ||
148 | wipeAttributes(template.file.content.document.head); | 156 | wipeAttributes(template.file.content.document.head); |
149 | //Copying attributes to maintain same properties as the <head> | 157 | //Copying attributes to maintain same properties as the <head> |
150 | for (var m in template.document.head.attributes) { | 158 | for (var m in template.document.head.attributes) { |
@@ -155,6 +163,7 @@ exports.TemplateDocumentMediator = Montage.create(Component, { | |||
155 | //Copying attributes to maintain same properties as the <html> | 163 | //Copying attributes to maintain same properties as the <html> |
156 | var htmlTagMem = template.document.getElementsByTagName('html')[0], htmlTagDoc = template.file.content.document.getElementsByTagName('html')[0]; | 164 | var htmlTagMem = template.document.getElementsByTagName('html')[0], htmlTagDoc = template.file.content.document.getElementsByTagName('html')[0]; |
157 | wipeAttributes(htmlTagDoc); | 165 | wipeAttributes(htmlTagDoc); |
166 | // | ||
158 | for (var m in htmlTagMem.attributes) { | 167 | for (var m in htmlTagMem.attributes) { |
159 | if (htmlTagMem.attributes[m].value) { | 168 | if (htmlTagMem.attributes[m].value) { |
160 | if (htmlTagMem.attributes[m].value.replace(/montage-app-bootstrapping/gi, '').length>0) { | 169 | if (htmlTagMem.attributes[m].value.replace(/montage-app-bootstrapping/gi, '').length>0) { |
@@ -162,10 +171,19 @@ exports.TemplateDocumentMediator = Montage.create(Component, { | |||
162 | } | 171 | } |
163 | } | 172 | } |
164 | } | 173 | } |
174 | // | ||
175 | if (htmlTagMem && htmlTagMem.getAttribute('data-ninja-style') !== null) { | ||
176 | htmlTagDoc.setAttribute('style', htmlTagMem.getAttribute('data-ninja-style')); | ||
177 | htmlTagDoc.removeAttribute('data-ninja-style'); | ||
178 | } else if (htmlTagMem && htmlTagMem.getAttribute('data-ninja-style') === null) { | ||
179 | htmlTagDoc.removeAttribute('style'); | ||
180 | htmlTagDoc.removeAttribute('data-ninja-style'); | ||
181 | } | ||
165 | //Getting list of current nodes (Ninja DOM) | 182 | //Getting list of current nodes (Ninja DOM) |
166 | presentNodes = template.file.content.document.getElementsByTagName('*'); | 183 | presentNodes = template.file.content.document.getElementsByTagName('*'); |
167 | //Looping through nodes to determine origin and removing if not inserted by Ninja | 184 | //Looping through nodes to determine origin and removing if not inserted by Ninja |
168 | for (var n in presentNodes) { | 185 | for (var n in presentNodes) { |
186 | // | ||
169 | if (presentNodes[n].getAttribute && presentNodes[n].getAttribute('data-ninja-node') === null) { | 187 | if (presentNodes[n].getAttribute && presentNodes[n].getAttribute('data-ninja-node') === null) { |
170 | toremovetags.push(presentNodes[n]); | 188 | toremovetags.push(presentNodes[n]); |
171 | } else if (presentNodes[n].getAttribute && presentNodes[n].getAttribute('data-ninja-node') !== null) { | 189 | } else if (presentNodes[n].getAttribute && presentNodes[n].getAttribute('data-ninja-node') !== null) { |