fix: perf

This commit is contained in:
alexander.akait 2023-05-04 18:21:57 +03:00
parent fb1d14e64a
commit 4e8f8144fd
2 changed files with 23 additions and 17 deletions

View File

@ -812,24 +812,26 @@ class CssParser extends Parser {
return end;
},
pseudoClass: (input, start, end) => {
switch (mode) {
case CSS_MODE_TOP_LEVEL: {
const name = input.slice(start, end).toLowerCase();
if (this.allowModeSwitch && name === ":global") {
modeData = "global";
const dep = new ConstDependency("", [start, end]);
module.addPresentationalDependency(dep);
} else if (this.allowModeSwitch && name === ":local") {
modeData = "local";
const dep = new ConstDependency("", [start, end]);
module.addPresentationalDependency(dep);
} else if (this.allowPseudoBlocks && name === ":export") {
const pos = parseExports(input, end);
const dep = new ConstDependency("", [start, pos]);
module.addPresentationalDependency(dep);
return pos;
if (this.allowModeSwitch) {
switch (mode) {
case CSS_MODE_TOP_LEVEL: {
const name = input.slice(start, end).toLowerCase();
if (name === ":global") {
modeData = "global";
const dep = new ConstDependency("", [start, end]);
module.addPresentationalDependency(dep);
} else if (name === ":local") {
modeData = "local";
const dep = new ConstDependency("", [start, end]);
module.addPresentationalDependency(dep);
} else if (name === ":export") {
const pos = parseExports(input, end);
const dep = new ConstDependency("", [start, pos]);
module.addPresentationalDependency(dep);
return pos;
}
break;
}
break;
}
}
return end;

View File

@ -395,6 +395,10 @@
}
}
@unknown .class {
color: red;
}
:scope {
color: red;
}