ソースを参照

fixed support of !important

Gildas 7 年 前
コミット
3801aae270
1 ファイル変更2 行追加2 行削除
  1. 2 2
      lib/single-file/rules-matcher.js

+ 2 - 2
lib/single-file/rules-matcher.js

@@ -141,7 +141,7 @@ this.RulesMatcher = this.RulesMatcher || (() => {
 				stylesInfo.forEach(styleInfo => {
 					const important = cssStyle.getPropertyPriority(styleInfo.name) == PRIORITY_IMPORTANT;
 					const styleValue = cssStyle.getPropertyValue(styleInfo.name) + (important ? " !" + PRIORITY_IMPORTANT : "");
-					elementStylesInfo.set(styleInfo.name, { styleValue, cssStyle: ruleInfo.cssStyle });
+					elementStylesInfo.set(styleInfo.name, { styleValue, cssStyle: ruleInfo.cssStyle, important });
 				});
 			} else {
 				const cssStyle = ruleInfo.cssRule.style;
@@ -151,7 +151,7 @@ this.RulesMatcher = this.RulesMatcher || (() => {
 					const styleValue = cssStyle.getPropertyValue(styleInfo.name) + (important ? " !" + PRIORITY_IMPORTANT : "");
 					let elementStyleInfo = elementStylesInfo.get(styleInfo.name);
 					if (!elementStyleInfo || (important && !elementStyleInfo.important)) {
-						elementStylesInfo.set(styleInfo.name, { styleValue, cssRule: ruleInfo.cssRule, selectorText: ruleInfo.selectorText, selectorsText: ruleInfo.selectorsText });
+						elementStylesInfo.set(styleInfo.name, { styleValue, cssRule: ruleInfo.cssRule, selectorText: ruleInfo.selectorText, selectorsText: ruleInfo.selectorsText, important });
 					}
 				});
 			}