aboutsummaryrefslogtreecommitdiff
path: root/js/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'js/controllers')
-rwxr-xr-xjs/controllers/styles-controller.js19
1 files changed, 18 insertions, 1 deletions
diff --git a/js/controllers/styles-controller.js b/js/controllers/styles-controller.js
index 041794e0..11d53ac0 100755
--- a/js/controllers/styles-controller.js
+++ b/js/controllers/styles-controller.js
@@ -1477,7 +1477,8 @@ var stylesController = exports.StylesController = Montage.create(Component, {
1477 rel : 'stylesheet', 1477 rel : 'stylesheet',
1478 id : id || "", 1478 id : id || "",
1479 media : 'screen', 1479 media : 'screen',
1480 title : 'Temp' 1480 title : 'Temp',
1481 'data-ninja-node' : 'true'
1481 }); 1482 });
1482 1483
1483 doc.head.appendChild(sheetElement); 1484 doc.head.appendChild(sheetElement);
@@ -1504,6 +1505,9 @@ var stylesController = exports.StylesController = Montage.create(Component, {
1504 sheetEl.disabled = true; 1505 sheetEl.disabled = true;
1505 this.userStyleSheets.splice(this.userStyleSheets.indexOf(sheet), 1); 1506 this.userStyleSheets.splice(this.userStyleSheets.indexOf(sheet), 1);
1506 1507
1508 ///// Make sure cached rules from this stylesheet are not used
1509 this._clearCache();
1510
1507 ///// Check to see if we're removing the default style sheet 1511 ///// Check to see if we're removing the default style sheet
1508 if(sheet === this._defaultStylesheet) { 1512 if(sheet === this._defaultStylesheet) {
1509 sheetCount = this.userStyleSheets.length; 1513 sheetCount = this.userStyleSheets.length;
@@ -1541,6 +1545,18 @@ var stylesController = exports.StylesController = Montage.create(Component, {
1541 } 1545 }
1542 }, 1546 },
1543 1547
1548 setMediaAttribute : {
1549 value: function(sheet, mediaString) {
1550 if(sheet.media.mediaText === mediaString) { return false; }
1551
1552 sheet.ownerNode.setAttribute('media', mediaString);
1553
1554 this._clearCache();
1555
1556 this.styleSheetModified(sheet);
1557 }
1558 },
1559
1544 ///// Style Sheet Modified 1560 ///// Style Sheet Modified
1545 ///// Method to call whenever a stylesheet change is made 1561 ///// Method to call whenever a stylesheet change is made
1546 ///// Dispatches an event, and keeps list of dirty style sheets 1562 ///// Dispatches an event, and keeps list of dirty style sheets
@@ -1558,6 +1574,7 @@ var stylesController = exports.StylesController = Montage.create(Component, {
1558 ///// If the sheet doesn't already exist in the list of modified 1574 ///// If the sheet doesn't already exist in the list of modified
1559 ///// sheets, dispatch dirty event and add the sheet to the list 1575 ///// sheets, dispatch dirty event and add the sheet to the list
1560 if(sheetSearch.length === 0) { 1576 if(sheetSearch.length === 0) {
1577 NJevent('styleSheetDirty', eventData);
1561 this.dirtyStyleSheets.push({ 1578 this.dirtyStyleSheets.push({
1562 document : sheet.ownerNode.ownerDocument, 1579 document : sheet.ownerNode.ownerDocument,
1563 stylesheet : sheet 1580 stylesheet : sheet