|
|
@@ -85,7 +85,7 @@ this.RulesMatcher = this.RulesMatcher || (() => {
|
|
|
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))) {
|
|
|
+ if (isUnmatchedSelector(selectorText, unmatchedSelectorsCache)) {
|
|
|
matchedElements = [];
|
|
|
} else {
|
|
|
matchedElements = doc.querySelectorAll(selectorText);
|
|
|
@@ -125,6 +125,16 @@ this.RulesMatcher = this.RulesMatcher || (() => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ // if (unmatchedSelectorsCache.find(selector => selectorText.startsWith(selector))) {
|
|
|
+
|
|
|
+ function isUnmatchedSelector(selector, unmatchedSelectorsCache) {
|
|
|
+ let selectorIndex = 0;
|
|
|
+ while (selectorIndex < unmatchedSelectorsCache.length && !selector.startsWith(unmatchedSelectorsCache[selectorIndex])) {
|
|
|
+ selectorIndex++;
|
|
|
+ }
|
|
|
+ return selector.startsWith(unmatchedSelectorsCache[selectorIndex]);
|
|
|
+ }
|
|
|
+
|
|
|
function computeCascade(mediaInfo, parentMediaInfos, mediaAllInfo) {
|
|
|
mediaInfo.elements.forEach(elementInfo => getStylesInfo(elementInfo).forEach((elementStyleInfo, styleName) => {
|
|
|
let ruleInfo, ascendantMedia;
|