|
@@ -41,9 +41,9 @@ this.matchedRules = this.matchedRules || (() => {
|
|
|
if (stylesheetInfo.mediaText && stylesheetInfo.mediaText != MEDIA_ALL) {
|
|
if (stylesheetInfo.mediaText && stylesheetInfo.mediaText != MEDIA_ALL) {
|
|
|
const mediaInfo = createMediaInfo(stylesheetInfo.mediaText);
|
|
const mediaInfo = createMediaInfo(stylesheetInfo.mediaText);
|
|
|
this.mediaAllInfo.medias.set("style-" + sheetIndex + "-" + stylesheetInfo.mediaText, mediaInfo);
|
|
this.mediaAllInfo.medias.set("style-" + sheetIndex + "-" + stylesheetInfo.mediaText, mediaInfo);
|
|
|
- getMatchedElementsRules(doc, cssRules, mediaInfo, sheetIndex, styles, matchedElementsCache, workStyleElement.sheet);
|
|
|
|
|
|
|
+ getMatchedElementsRules(doc, cssRules, mediaInfo, sheetIndex, styles, matchedElementsCache, workStyleElement);
|
|
|
} else {
|
|
} else {
|
|
|
- getMatchedElementsRules(doc, cssRules, this.mediaAllInfo, sheetIndex, styles, matchedElementsCache, workStyleElement.sheet);
|
|
|
|
|
|
|
+ getMatchedElementsRules(doc, cssRules, this.mediaAllInfo, sheetIndex, styles, matchedElementsCache, workStyleElement);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
sheetIndex++;
|
|
sheetIndex++;
|
|
@@ -59,7 +59,7 @@ this.matchedRules = this.matchedRules || (() => {
|
|
|
startTime = Date.now();
|
|
startTime = Date.now();
|
|
|
log(" -- STARTED computeCascade");
|
|
log(" -- STARTED computeCascade");
|
|
|
}
|
|
}
|
|
|
- computeCascade(this.mediaAllInfo, [], this.mediaAllInfo, workStyleElement.sheet);
|
|
|
|
|
|
|
+ computeCascade(this.mediaAllInfo, [], this.mediaAllInfo, workStyleElement);
|
|
|
workStyleElement.remove();
|
|
workStyleElement.remove();
|
|
|
if (DEBUG) {
|
|
if (DEBUG) {
|
|
|
log(" -- ENDED computeCascade", Date.now() - startTime);
|
|
log(" -- ENDED computeCascade", Date.now() - startTime);
|
|
@@ -122,16 +122,8 @@ this.matchedRules = this.matchedRules || (() => {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function invalidSelector(selectorText, workStylesheet) {
|
|
function invalidSelector(selectorText, workStylesheet) {
|
|
|
- let invalidSelector;
|
|
|
|
|
- try {
|
|
|
|
|
- workStylesheet.insertRule(selectorText + "{}");
|
|
|
|
|
- workStylesheet.deleteRule(0);
|
|
|
|
|
- } catch (error) {
|
|
|
|
|
- if (!selectorText.match(REGEXP_VENDOR_IDENTIFIER)) {
|
|
|
|
|
- invalidSelector = true;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- return invalidSelector;
|
|
|
|
|
|
|
+ workStylesheet.textContent = selectorText + "{}";
|
|
|
|
|
+ return !workStylesheet.sheet.cssRules.length;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function getMatchedElementsSelector(doc, selectorInfo, styles, matchedElementsCache) {
|
|
function getMatchedElementsSelector(doc, selectorInfo, styles, matchedElementsCache) {
|
|
@@ -298,13 +290,12 @@ this.matchedRules = this.matchedRules || (() => {
|
|
|
|
|
|
|
|
function invalidDeclaration(declarationText, workStylesheet) {
|
|
function invalidDeclaration(declarationText, workStylesheet) {
|
|
|
let invalidDeclaration;
|
|
let invalidDeclaration;
|
|
|
- workStylesheet.insertRule("single-file-declaration { " + declarationText + "}");
|
|
|
|
|
- if (!workStylesheet.cssRules[0].style.length) {
|
|
|
|
|
|
|
+ workStylesheet.textContent = "single-file-declaration { " + declarationText + "}";
|
|
|
|
|
+ if (!workStylesheet.sheet.cssRules[0].style.length) {
|
|
|
if (!declarationText.match(REGEXP_VENDOR_IDENTIFIER)) {
|
|
if (!declarationText.match(REGEXP_VENDOR_IDENTIFIER)) {
|
|
|
invalidDeclaration = true;
|
|
invalidDeclaration = true;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- workStylesheet.deleteRule(0);
|
|
|
|
|
return invalidDeclaration;
|
|
return invalidDeclaration;
|
|
|
}
|
|
}
|
|
|
|
|
|