|
|
@@ -104,7 +104,7 @@ this.matchedRules = this.matchedRules || (() => {
|
|
|
} else if (cssRule.type == "Rule" && cssRule.prelude.children) {
|
|
|
const selectors = cssRule.prelude.children.toArray();
|
|
|
const selectorsText = cssRule.prelude.children.toArray().map(selector => cssTree.generate(selector));
|
|
|
- const ruleInfo = { cssRule, mediaInfo, ruleIndex, sheetIndex, matchedSelectors: new Set(), declarations: new Map(), selectors, selectorsText };
|
|
|
+ const ruleInfo = { cssRule, mediaInfo, ruleIndex, sheetIndex, matchedSelectors: new Set(), declarations: new Set(), selectors, selectorsText };
|
|
|
if (!invalidSelector(selectorsText.join(","), stylesheet)) {
|
|
|
for (let selector = cssRule.prelude.children.head, selectorIndex = 0; selector; selector = selector.next, selectorIndex++) {
|
|
|
const selectorText = selectorsText[selectorIndex];
|
|
|
@@ -214,7 +214,7 @@ this.matchedRules = this.matchedRules || (() => {
|
|
|
if (!elementInfo) {
|
|
|
elementInfo = [];
|
|
|
if (elementStyle) {
|
|
|
- elementInfo.push({ styleInfo: { cssStyle: elementStyle, declarations: new Map() } });
|
|
|
+ elementInfo.push({ styleInfo: { cssStyle: elementStyle, declarations: new Set() } });
|
|
|
}
|
|
|
mediaInfo.elements.set(element, elementInfo);
|
|
|
}
|
|
|
@@ -254,9 +254,8 @@ this.matchedRules = this.matchedRules || (() => {
|
|
|
mediaAllInfo.matchedStyles.set(cssStyle, info);
|
|
|
}
|
|
|
}
|
|
|
- const styleValue = info.declarations.get(property);
|
|
|
- if (!styleValue) {
|
|
|
- info.declarations.set(property, declarationsInfo.styleValue);
|
|
|
+ if (!info.declarations.has(property)) {
|
|
|
+ info.declarations.add(property);
|
|
|
}
|
|
|
}
|
|
|
}));
|
|
|
@@ -284,10 +283,9 @@ this.matchedRules = this.matchedRules || (() => {
|
|
|
const declarationData = declaration.data;
|
|
|
const declarationText = cssTree.generate(declarationData);
|
|
|
if (declarationData.type == "Declaration" && (declarationText.match(REGEXP_VENDOR_IDENTIFIER) || !processedProperties.has(declarationData.property)) && !invalidDeclaration(declarationText, stylesheet)) {
|
|
|
- const styleValue = cssTree.generate(declarationData.value);
|
|
|
- const elementStyleInfo = declarationsInfo.get(declarationData);
|
|
|
- if (styleValue.trim() && (!elementStyleInfo || (declarationData.important && !elementStyleInfo.important))) {
|
|
|
- declarationsInfo.set(declarationData, { selectorInfo, styleValue, important: declarationData.important });
|
|
|
+ const declarationInfo = declarationsInfo.get(declarationData);
|
|
|
+ if (!declarationInfo || (declarationData.important && !declarationInfo.important)) {
|
|
|
+ declarationsInfo.set(declarationData, { selectorInfo, important: declarationData.important });
|
|
|
processedProperties.add(declarationData.property);
|
|
|
}
|
|
|
}
|