aboutsummaryrefslogtreecommitdiff
path: root/js/document/html-document.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/document/html-document.js')
-rwxr-xr-xjs/document/html-document.js24
1 files changed, 13 insertions, 11 deletions
diff --git a/js/document/html-document.js b/js/document/html-document.js
index 564daef3..3f417ffc 100755
--- a/js/document/html-document.js
+++ b/js/document/html-document.js
@@ -389,8 +389,9 @@ exports.HTMLDocument = Montage.create(TextDocument, {
389 this._window = this.iframe.contentWindow; 389 this._window = this.iframe.contentWindow;
390 // 390 //
391 for (var k in this._document.styleSheets) { 391 for (var k in this._document.styleSheets) {
392 this._document.styleSheets[k].ninjatemplate = true; 392 if (this._document.styleSheets[k].ownerNode && this._document.styleSheets[k].ownerNode.setAttribute) {
393 //TODO: Add as attribute 393 this._document.styleSheets[k].ownerNode.setAttribute('ninjatemplate', 'true');
394 }
394 } 395 }
395 // 396 //
396 if(!this.documentRoot.Ninja) this.documentRoot.Ninja = {}; 397 if(!this.documentRoot.Ninja) this.documentRoot.Ninja = {};
@@ -449,11 +450,8 @@ exports.HTMLDocument = Montage.create(TextDocument, {
449 //////////////////////////////////////////////////////////////////////////// 450 ////////////////////////////////////////////////////////////////////////////
450 //////////////////////////////////////////////////////////////////////////// 451 ////////////////////////////////////////////////////////////////////////////
451 452
452 //TODO: Revisit this logic 453 //TODO: Check if this is needed
453 /* this._styles = this._document.styleSheets[1]; */ 454 this._stylesheets = this._document.styleSheets;
454 this._stylesheets = this._document.styleSheets; // Entire stlyesheets array
455
456 console.log(this._document.styleSheets);
457 455
458 //////////////////////////////////////////////////////////////////////////// 456 ////////////////////////////////////////////////////////////////////////////
459 //////////////////////////////////////////////////////////////////////////// 457 ////////////////////////////////////////////////////////////////////////////
@@ -574,8 +572,10 @@ exports.HTMLDocument = Montage.create(TextDocument, {
574 if (this.currentView === 'design') { 572 if (this.currentView === 'design') {
575 var styles = []; 573 var styles = [];
576 for (var k in this._document.styleSheets) { 574 for (var k in this._document.styleSheets) {
577 if (!this._document.styleSheets[k].ninjatemplate) { 575 if (this._document.styleSheets[k].ownerNode && this._document.styleSheets[k].ownerNode.getAttribute) {
578 styles.push(this._document.styleSheets[k]); 576 if (this._document.styleSheets[k].ownerNode.getAttribute('ninjatemplate') === null) {
577 styles.push(this._document.styleSheets[k]);
578 }
579 } 579 }
580 } 580 }
581 return {mode: 'html', document: this._userDocument, webgl: this.glData, styles: styles, head: this._templateDocument.head.innerHTML, body: this._templateDocument.body.innerHTML}; 581 return {mode: 'html', document: this._userDocument, webgl: this.glData, styles: styles, head: this._templateDocument.head.innerHTML, body: this._templateDocument.body.innerHTML};
@@ -595,8 +595,10 @@ exports.HTMLDocument = Montage.create(TextDocument, {
595 if (this.currentView === 'design') { 595 if (this.currentView === 'design') {
596 var css = []; 596 var css = [];
597 for (var k in this._document.styleSheets) { 597 for (var k in this._document.styleSheets) {
598 if (!this._document.styleSheets[k].ninjatemplate) { 598 if (this._document.styleSheets[k].ownerNode && this._document.styleSheets[k].ownerNode.getAttribute) {
599 css.push(this._document.styleSheets[k]); 599 if (this._document.styleSheets[k].ownerNode.getAttribute('ninjatemplate') === null) {
600 css.push(this._document.styleSheets[k]);
601 }
600 } 602 }
601 } 603 }
602 return {mode: 'html', document: this._userDocument, webgl: this.glData, css: css, head: this._templateDocument.head.innerHTML, body: this._templateDocument.body.innerHTML}; 604 return {mode: 'html', document: this._userDocument, webgl: this.glData, css: css, head: this._templateDocument.head.innerHTML, body: this._templateDocument.body.innerHTML};