diff options
Diffstat (limited to 'js/controllers/styles-controller.js')
-rwxr-xr-x | js/controllers/styles-controller.js | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/js/controllers/styles-controller.js b/js/controllers/styles-controller.js index b50f43cc..6e363798 100755 --- a/js/controllers/styles-controller.js +++ b/js/controllers/styles-controller.js | |||
@@ -213,6 +213,9 @@ var stylesController = exports.StylesController = Montage.create(Component, { | |||
213 | 213 | ||
214 | stylesheet.insertRule(ruleText, index); | 214 | stylesheet.insertRule(ruleText, index); |
215 | 215 | ||
216 | ///// Invalidate cache because rule dominance is affected | ||
217 | this._clearCache(); | ||
218 | |||
216 | this.styleSheetModified(stylesheet); | 219 | this.styleSheetModified(stylesheet); |
217 | 220 | ||
218 | rule = stylesheet.rules[index]; | 221 | rule = stylesheet.rules[index]; |
@@ -791,7 +794,7 @@ var stylesController = exports.StylesController = Montage.create(Component, { | |||
791 | var a = this._getMostSpecificSelectorForElement(element, rule1[this.CONST.SPECIFICITY_KEY]), | 794 | var a = this._getMostSpecificSelectorForElement(element, rule1[this.CONST.SPECIFICITY_KEY]), |
792 | b = this._getMostSpecificSelectorForElement(element, rule2[this.CONST.SPECIFICITY_KEY]), | 795 | b = this._getMostSpecificSelectorForElement(element, rule2[this.CONST.SPECIFICITY_KEY]), |
793 | win = element.ownerDocument.defaultView, | 796 | win = element.ownerDocument.defaultView, |
794 | order; | 797 | order, sheetAIndex, sheetBIndex, ruleAIndex, ruleBIndex; |
795 | 798 | ||
796 | order = this.compareSpecificity(a.specificity, b.specificity); | 799 | order = this.compareSpecificity(a.specificity, b.specificity); |
797 | 800 | ||
@@ -802,9 +805,9 @@ var stylesController = exports.StylesController = Montage.create(Component, { | |||
802 | /// If tied again (same sheet), determine which is further down in the sheet | 805 | /// If tied again (same sheet), determine which is further down in the sheet |
803 | if(sheetAIndex === sheetBIndex) { | 806 | if(sheetAIndex === sheetBIndex) { |
804 | ruleAIndex = this.getRuleIndex(rule1); ruleBIndex = this.getRuleIndex(rule2); | 807 | ruleAIndex = this.getRuleIndex(rule1); ruleBIndex = this.getRuleIndex(rule2); |
805 | return ruleAIndex < ruleBIndex ? 1 : (ruleAIndex > ruleBIndex) ? -1 : 0; | 808 | return ruleAIndex < ruleBIndex ? false : (ruleAIndex > ruleBIndex) ? true : false; |
806 | } else { | 809 | } else { |
807 | return sheetAIndex < sheetBIndex ? 1 : (sheetAIndex > sheetBIndex) ? -1 : 0; | 810 | return sheetAIndex < sheetBIndex ? false : (sheetAIndex > sheetBIndex) ? true : false; |
808 | } | 811 | } |
809 | } | 812 | } |
810 | 813 | ||
@@ -1453,11 +1456,11 @@ var stylesController = exports.StylesController = Montage.create(Component, { | |||
1453 | 1456 | ||
1454 | ///// Dispatch modified event | 1457 | ///// Dispatch modified event |
1455 | NJevent('styleSheetModified', eventData); | 1458 | NJevent('styleSheetModified', eventData); |
1459 | this.currentDocument.model.needsSave = true; | ||
1456 | 1460 | ||
1457 | ///// If the sheet doesn't already exist in the list of modified | 1461 | ///// If the sheet doesn't already exist in the list of modified |
1458 | ///// sheets, dispatch dirty event and add the sheet to the list | 1462 | ///// sheets, dispatch dirty event and add the sheet to the list |
1459 | if(sheetSearch.length === 0) { | 1463 | if(sheetSearch.length === 0) { |
1460 | this.currentDocument.model.needsSave = true; | ||
1461 | this.dirtyStyleSheets.push({ | 1464 | this.dirtyStyleSheets.push({ |
1462 | document : sheet.ownerNode.ownerDocument, | 1465 | document : sheet.ownerNode.ownerDocument, |
1463 | stylesheet : sheet | 1466 | stylesheet : sheet |