fix(css): comments in selectors (#3909)
This commit is contained in:
1 parent
6b5765da36
commit
9e6bd15ade
10 files changed
+249
-64
No files matched your search
@@ -11,7 +11,7 @@ function parseSelector(selector) {
|
||||
if (selector.match(/\/\/|\/\*/)) {
|
||||
return {
|
||||
type: "selector-comment",
|
||||
value: selector
|
||||
value: selector.replace(/^ +/, "").replace(/ +$/, "")
|
||||
};
|
||||
}
|
||||
const selectorParser = require("postcss-selector-parser");
|
||||
@@ -218,10 +218,14 @@ function parseNestedCSS(node) {
|
||||
}
|
||||
|
||||
if (typeof node.selector === "string" && node.selector.trim().length > 0) {
|
||||
const selector = node.raws.selector
|
||||
let selector = node.raws.selector
|
||||
? node.raws.selector.raw
|
||||
: node.selector;
|
||||
|
||||
if (node.raws.between && node.raws.between.trim()) {
|
||||
selector += node.raws.between;
|
||||
}
|
||||
|
||||
if (selector.startsWith("@") && selector.endsWith(":")) {
|
||||
return node;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user