aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rwxr-xr-xjs/controllers/styles-controller.js11
1 files changed, 8 insertions, 3 deletions
diff --git a/js/controllers/styles-controller.js b/js/controllers/styles-controller.js
index 0f847653..47c63c09 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];
@@ -775,7 +778,7 @@ var stylesController = exports.StylesController = Montage.create(Component, {
775 var a = this._getMostSpecificSelectorForElement(element, rule1[this.CONST.SPECIFICITY_KEY]), 778 var a = this._getMostSpecificSelectorForElement(element, rule1[this.CONST.SPECIFICITY_KEY]),
776 b = this._getMostSpecificSelectorForElement(element, rule2[this.CONST.SPECIFICITY_KEY]), 779 b = this._getMostSpecificSelectorForElement(element, rule2[this.CONST.SPECIFICITY_KEY]),
777 win = element.ownerDocument.defaultView, 780 win = element.ownerDocument.defaultView,
778 order; 781 order, sheetAIndex, sheetBIndex, ruleAIndex, ruleBIndex;
779 782
780 order = this.compareSpecificity(a.specificity, b.specificity); 783 order = this.compareSpecificity(a.specificity, b.specificity);
781 784
@@ -786,9 +789,9 @@ var stylesController = exports.StylesController = Montage.create(Component, {
786 /// If tied again (same sheet), determine which is further down in the sheet 789 /// If tied again (same sheet), determine which is further down in the sheet
787 if(sheetAIndex === sheetBIndex) { 790 if(sheetAIndex === sheetBIndex) {
788 ruleAIndex = this.getRuleIndex(rule1); ruleBIndex = this.getRuleIndex(rule2); 791 ruleAIndex = this.getRuleIndex(rule1); ruleBIndex = this.getRuleIndex(rule2);
789 return ruleAIndex < ruleBIndex ? 1 : (ruleAIndex > ruleBIndex) ? -1 : 0; 792 return ruleAIndex < ruleBIndex ? false : (ruleAIndex > ruleBIndex) ? true : false;
790 } else { 793 } else {
791 return sheetAIndex < sheetBIndex ? 1 : (sheetAIndex > sheetBIndex) ? -1 : 0; 794 return sheetAIndex < sheetBIndex ? false : (sheetAIndex > sheetBIndex) ? true : false;
792 } 795 }
793 } 796 }
794 797
@@ -1552,6 +1555,7 @@ var stylesController = exports.StylesController = Montage.create(Component, {
1552 value: function(el, property, rule) { 1555 value: function(el, property, rule) {
1553 if(!el.elementModel) { return false; } /// return null if there is no element model 1556 if(!el.elementModel) { return false; } /// return null if there is no element model
1554 1557
1558 console.log("Setting cache for property: ", property);
1555 this._cacheHistory.push({ 1559 this._cacheHistory.push({
1556 rule: rule, 1560 rule: rule,
1557 element: el, 1561 element: el,
@@ -1614,6 +1618,7 @@ var stylesController = exports.StylesController = Montage.create(Component, {
1614 if(!element) { 1618 if(!element) {
1615 this._cacheHistory = null; 1619 this._cacheHistory = null;
1616 this._cacheHistory = []; 1620 this._cacheHistory = [];
1621 console.log("Removing cache: ", this._cacheHistory);
1617 } 1622 }
1618 1623
1619 } 1624 }