Gildas 7 лет назад
Родитель
Сommit
a2142d29a8
1 измененных файлов с 6 добавлено и 4 удалено
  1. 6 4
      lib/single-file/css-matched-rules.js

+ 6 - 4
lib/single-file/css-matched-rules.js

@@ -246,10 +246,12 @@ this.matchedRules = this.matchedRules || (() => {
 				});
 			} else {
 				selectorInfo.ruleInfo.cssRule.block.children.forEach(declaration => {
-					const styleValue = cssTree.generate(declaration.value);
-					const elementStyleInfo = elementStylesInfo.get(declaration.property);
-					if (styleValue.trim() && (!elementStyleInfo || (declaration.important && !elementStyleInfo.important))) {
-						elementStylesInfo.set(declaration.property, { selectorInfo, styleValue, important: declaration.important });
+					if (declaration.type == "Declaration") {
+						const styleValue = cssTree.generate(declaration.value);
+						const elementStyleInfo = elementStylesInfo.get(declaration.property);
+						if (styleValue.trim() && (!elementStyleInfo || (declaration.important && !elementStyleInfo.important))) {
+							elementStylesInfo.set(declaration.property, { selectorInfo, styleValue, important: declaration.important });
+						}
 					}
 				});
 			}