diff options
author | Jose Antonio Marquez | 2012-06-14 16:54:54 -0700 |
---|---|---|
committer | Jose Antonio Marquez | 2012-06-14 16:54:54 -0700 |
commit | b39e13b9a53e6c75f4f9364e686dc90df02b09bb (patch) | |
tree | 400befe82ae113177e6031025ba070e3770cbcff /js/document | |
parent | 0d6693f1a6af1303e99ee72794eb879be8665610 (diff) | |
download | ninja-b39e13b9a53e6c75f4f9364e686dc90df02b09bb.tar.gz |
Moving location to copy body style attribute
Fixes issue with removing styles from other elements. This now only applies to HTML and Body tags
Diffstat (limited to 'js/document')
-rwxr-xr-x | js/document/mediators/template.js | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/js/document/mediators/template.js b/js/document/mediators/template.js index 0d48355f..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) { |
@@ -182,14 +190,6 @@ exports.TemplateDocumentMediator = Montage.create(Component, { | |||
182 | //Removing attribute | 190 | //Removing attribute |
183 | presentNodes[n].removeAttribute('data-ninja-node'); | 191 | presentNodes[n].removeAttribute('data-ninja-node'); |
184 | } | 192 | } |
185 | // | ||
186 | if (presentNodes[n].getAttribute && presentNodes[n].getAttribute('data-ninja-style') !== null) { | ||
187 | presentNodes[n].setAttribute('style', presentNodes[n].getAttribute('data-ninja-style')); | ||
188 | presentNodes[n].removeAttribute('data-ninja-style'); | ||
189 | } else if (presentNodes[n].getAttribute && presentNodes[n].getAttribute('data-ninja-style') === null) { | ||
190 | presentNodes[n].removeAttribute('style'); | ||
191 | presentNodes[n].removeAttribute('data-ninja-style'); | ||
192 | } | ||
193 | } | 193 | } |
194 | //Getting all CSS (style or link) tags | 194 | //Getting all CSS (style or link) tags |
195 | var styletags = template.file.content.document.getElementsByTagName('style'), | 195 | var styletags = template.file.content.document.getElementsByTagName('style'), |