diff options
author | Eric Guzman | 2012-05-18 14:05:06 -0700 |
---|---|---|
committer | Eric Guzman | 2012-05-18 14:05:06 -0700 |
commit | 197a7646e472fcea616764685c8d03c6063e66f5 (patch) | |
tree | 793ef1007234f15958127b3c6f2fb3ff7b7a598b /js/controllers | |
parent | 18c260f5f55608d4774aea27f6c2d23e89921361 (diff) | |
download | ninja-197a7646e472fcea616764685c8d03c6063e66f5.tar.gz |
CSS Panel - Add support for deleting style sheets
Diffstat (limited to 'js/controllers')
-rwxr-xr-x | js/controllers/styles-controller.js | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/js/controllers/styles-controller.js b/js/controllers/styles-controller.js index f6977a00..c5076771 100755 --- a/js/controllers/styles-controller.js +++ b/js/controllers/styles-controller.js | |||
@@ -821,7 +821,7 @@ var stylesController = exports.StylesController = Montage.create(Component, { | |||
821 | ///// method to apply/test the new value | 821 | ///// method to apply/test the new value |
822 | dec.setProperty(property, value, priority); | 822 | dec.setProperty(property, value, priority); |
823 | 823 | ||
824 | if(rule.parentStyleSheet) { | 824 | if(rule.type !== 'inline' && rule.parentStyleSheet) { |
825 | this.styleSheetModified(rule.parentStyleSheet); | 825 | this.styleSheetModified(rule.parentStyleSheet); |
826 | } | 826 | } |
827 | 827 | ||
@@ -1289,6 +1289,27 @@ var stylesController = exports.StylesController = Montage.create(Component, { | |||
1289 | return sheet; | 1289 | return sheet; |
1290 | } | 1290 | } |
1291 | }, | 1291 | }, |
1292 | |||
1293 | ///// Remove Style sheet | ||
1294 | ///// Removes style sheet from document | ||
1295 | |||
1296 | removeStyleSheet : { | ||
1297 | value: function(sheet) { | ||
1298 | var sheetEl = sheet.ownerNode; | ||
1299 | |||
1300 | if(sheetEl) { | ||
1301 | sheetEl.disabled = true; | ||
1302 | this.userStyleSheets.splice(this.userStyleSheets.indexOf(sheet), 1); | ||
1303 | |||
1304 | ///// Mark for removal for i/o | ||
1305 | sheetEl.setAttribute('data-ninja-remove', 'true'); | ||
1306 | |||
1307 | NJevent('removeStyleSheet', sheet); | ||
1308 | } | ||
1309 | |||
1310 | |||
1311 | } | ||
1312 | }, | ||
1292 | 1313 | ||
1293 | ///// Gets the stylesheet object associated with passed-in | 1314 | ///// Gets the stylesheet object associated with passed-in |
1294 | ///// element or element id, with option context (document) | 1315 | ///// element or element id, with option context (document) |