|
|
@@ -70,20 +70,15 @@ this.RulesMatcher = this.RulesMatcher || (() => {
|
|
|
getMatchedElementsRules(doc, cssRule.cssRules, ruleMediaInfo, sheetIndex, matchedElementsCache, unmatchedSelectorsCache);
|
|
|
} else if (cssRule.type == CSSRule.STYLE_RULE) {
|
|
|
if (cssRule.selectorText) {
|
|
|
- try {
|
|
|
- let selectors = cssWhat.parse(cssRule.selectorText);
|
|
|
- const selectorsText = selectors.map(selector => cssWhat.stringify([selector]));
|
|
|
- selectors.forEach(selector => getMatchedElementsSelector(doc, cssRule, selector, selectorsText, mediaInfo, ruleIndex, sheetIndex, matchedElementsCache, unmatchedSelectorsCache));
|
|
|
- } catch (error) {
|
|
|
- /* ignored */
|
|
|
- }
|
|
|
+ let selectors = cssWhat.parse(cssRule.selectorText);
|
|
|
+ const selectorsText = selectors.map(selector => cssWhat.stringify([selector]));
|
|
|
+ selectors.forEach((selector, selectorIndex) => getMatchedElementsSelector(doc, cssRule, selector, selectorsText[selectorIndex], selectorsText, mediaInfo, ruleIndex, sheetIndex, matchedElementsCache, unmatchedSelectorsCache));
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- function getMatchedElementsSelector(doc, cssRule, selector, selectorsText, mediaInfo, ruleIndex, sheetIndex, matchedElementsCache, unmatchedSelectorsCache) {
|
|
|
- const selectorText = cssWhat.stringify([selector]);
|
|
|
+ function getMatchedElementsSelector(doc, cssRule, selector, selectorText, selectorsText, mediaInfo, ruleIndex, sheetIndex, matchedElementsCache, unmatchedSelectorsCache) {
|
|
|
let matchedElements = matchedElementsCache.get(selectorText);
|
|
|
if (!matchedElements) {
|
|
|
if (unmatchedSelectorsCache.find(selector => selectorText.startsWith(selector))) {
|