throw parser error when :global() appears without a selector (#4936)

pull/4994/head
Cameron Messinides 4 years ago committed by GitHub
parent c21a42edbf
commit e46e1afea5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -54,6 +54,13 @@ export default function read_style(parser: Parser, start: number, attributes: No
}, node.start);
}
if (node.type === 'PseudoClassSelector' && node.name === 'global' && node.children === null) {
parser.error({
code: `css-syntax-error`,
message: `:global() must contain a selector`
}, node.loc.start.offset);
}
if (node.loc) {
node.start = node.loc.start.offset;
node.end = node.loc.end.offset;
@ -87,4 +94,4 @@ function is_ref_selector(a: any, b: any) { // TODO add CSS node types
a.name === 'ref' &&
b.type === 'PseudoClassSelector'
);
}
}

@ -0,0 +1,10 @@
{
"code": "css-syntax-error",
"message": ":global() must contain a selector",
"start": {
"line": 2,
"column": 1,
"character": 9
},
"pos": 9
}
Loading…
Cancel
Save