aboutsummaryrefslogtreecommitdiff
path: root/js/document/views
diff options
context:
space:
mode:
Diffstat (limited to 'js/document/views')
-rwxr-xr-xjs/document/views/design.js45
1 files changed, 34 insertions, 11 deletions
diff --git a/js/document/views/design.js b/js/document/views/design.js
index 10963cab..a2bf965a 100755
--- a/js/document/views/design.js
+++ b/js/document/views/design.js
@@ -28,6 +28,11 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, {
28 }, 28 },
29 //////////////////////////////////////////////////////////////////// 29 ////////////////////////////////////////////////////////////////////
30 // 30 //
31 _headFragment: {
32 value: null
33 },
34 ////////////////////////////////////////////////////////////////////
35 //
31 content: { 36 content: {
32 value: null 37 value: null
33 }, 38 },
@@ -69,22 +74,40 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, {
69 // 74 //
70 this.document = this.iframe.contentWindow.document; 75 this.document = this.iframe.contentWindow.document;
71 // 76 //
72 77 this._headFragment = this.document.createElement('head');
73 78 this._headFragment.addEventListener('DOMSubtreeModified', this.insertHeadContent.bind(this), false);
74 79 this._headFragment.innerHTML = this.content.head;
75
76 //this.document.head.innerHTML += this.content.head;
77 this.document.body.innerHTML = this.content.head + this.content.body;
78
79
80
81
82 // 80 //
83 if (this._callback) this._callback(); 81 this.document.body.addEventListener('DOMSubtreeModified', this.bodyContentLoaded.bind(this), false);
82 this.document.body.innerHTML += this.content.body;
84 } 83 }
85 }, 84 },
86 //////////////////////////////////////////////////////////////////// 85 ////////////////////////////////////////////////////////////////////
87 // 86 //
87 bodyContentLoaded: {
88 value: function (e) {
89 //
90 this.document.body.removeEventListener('DOMSubtreeModified', this.bodyContentLoaded.bind(this), false);
91 //
92 if (this._callback) this._callback();
93 }
94 },
95 ////////////////////////////////////////////////////////////////////
96 //
97 insertHeadContent: {
98 value: function (e) {
99 //
100 this._headFragment.removeEventListener('DOMSubtreeModified', this.insertHeadContent, false);
101 //
102 for(var i in this._headFragment.childNodes) {
103 if(this._headFragment.childNodes[i].outerHTML) {
104 this.document.head.appendChild(this._headFragment.childNodes[i]);
105 }
106 }
107 }
108 },
109 ////////////////////////////////////////////////////////////////////
110 //
88 initCss: { 111 initCss: {
89 value: function () { 112 value: function () {
90 // 113 //