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

+ 3 - 3
lib/single-file/css-rules-matcher.js

@@ -86,12 +86,12 @@ this.RulesMatcher = this.RulesMatcher || (() => {
 		const selectorText = cssWhat.stringify([selector]);
 		let matchedElements = matchedElementsCache.get(selectorText);
 		if (!matchedElements) {
-			if (unmatchedSelectorsCache.find(selector => selectorText.startsWith(selector + " "))) {
+			if (unmatchedSelectorsCache.find(selector => selectorText.startsWith(selector))) {
 				matchedElements = [];
 			} else {
 				matchedElements = doc.querySelectorAll(selectorText);
-				if (!matchedElements.length && !unmatchedSelectorsCache.includes(selectorText)) {
-					unmatchedSelectorsCache.push(selectorText);
+				if (!matchedElements.length) {
+					unmatchedSelectorsCache.push(selectorText + " ");
 				}
 			}
 			matchedElementsCache.set(selectorText, matchedElements);