aboutsummaryrefslogtreecommitdiff
path: root/js/controllers/styles-controller.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/controllers/styles-controller.js')
-rwxr-xr-xjs/controllers/styles-controller.js23
1 files changed, 17 insertions, 6 deletions
diff --git a/js/controllers/styles-controller.js b/js/controllers/styles-controller.js
index ec4314f9..3422427c 100755
--- a/js/controllers/styles-controller.js
+++ b/js/controllers/styles-controller.js
@@ -94,11 +94,18 @@ var stylesController = exports.StylesController = Montage.create(Component, {
94 // Returns null if sheet not found (as in non-ninja projects) 94 // Returns null if sheet not found (as in non-ninja projects)
95 // Setter will handle null case 95 // Setter will handle null case
96 this.defaultStylesheet = this.getSheetFromElement(this.CONST.DEFAULT_SHEET_ID); 96 this.defaultStylesheet = this.getSheetFromElement(this.CONST.DEFAULT_SHEET_ID);
97 97
98 //debugger; 98 this.userStyleSheets = nj.toArray(document._document.styleSheets).filter(function(sheet) {
99 return sheet !== this._stageStylesheet;
100 }, this);
101
102 NJevent('styleSheetsReady', this);
99 }, 103 },
100 enumerable : false 104 enumerable : false
101 }, 105 },
106 userStyleSheets : {
107 value : null
108 },
102 _stageStylesheet : { 109 _stageStylesheet : {
103 value : null 110 value : null
104 }, 111 },
@@ -183,6 +190,7 @@ var stylesController = exports.StylesController = Montage.create(Component, {
183 ///// attach specificity to rule object 190 ///// attach specificity to rule object
184 ///// if rule is css keyframes, return rule and don't attach specificity 191 ///// if rule is css keyframes, return rule and don't attach specificity
185 if (rule instanceof WebKitCSSKeyframesRule) { 192 if (rule instanceof WebKitCSSKeyframesRule) {
193
186 return rule; 194 return rule;
187 } 195 }
188 rule[this.CONST.SPECIFICITY_KEY] = this.getSpecificity(rule.selectorText); 196 rule[this.CONST.SPECIFICITY_KEY] = this.getSpecificity(rule.selectorText);
@@ -795,7 +803,9 @@ var stylesController = exports.StylesController = Montage.create(Component, {
795 ///// method to apply/test the new value 803 ///// method to apply/test the new value
796 dec.setProperty(property, value, priority); 804 dec.setProperty(property, value, priority);
797 805
798 this.styleSheetModified(rule.parentStyleSheet); 806 if(rule.parentStyleSheet) {
807 this.styleSheetModified(rule.parentStyleSheet);
808 }
799 809
800 ///// Return browser value for value we just set 810 ///// Return browser value for value we just set
801 return dec.getPropertyValue(property); 811 return dec.getPropertyValue(property);
@@ -1244,6 +1254,8 @@ var stylesController = exports.StylesController = Montage.create(Component, {
1244 1254
1245 this.styleSheetModified(sheet); 1255 this.styleSheetModified(sheet);
1246 1256
1257 NJevent('newStyleSheet', sheet);
1258
1247 return sheet; 1259 return sheet;
1248 } 1260 }
1249 }, 1261 },
@@ -1306,11 +1318,10 @@ var stylesController = exports.StylesController = Montage.create(Component, {
1306 this.dirtyStyleSheets.length = 0; 1318 this.dirtyStyleSheets.length = 0;
1307 1319
1308 if(doc) { 1320 if(doc) {
1309 var stillDirty = this.dirtyStyleSheets.filter(function(sheet) { 1321 this.dirtyStyleSheets = null;
1322 this.dirtyStyleSheets = this.dirtyStyleSheets.filter(function(sheet) {
1310 return sheet.document !== doc; 1323 return sheet.document !== doc;
1311 }); 1324 });
1312 this.dirtyStyleSheets = null;
1313 this.dirtyStyleSheets = stillDirty;
1314 } 1325 }
1315 1326
1316 1327