|
|
|
@ -6,7 +6,7 @@ const REGEX_ATTRIBUTE_FLAGS = /^[a-zA-Z]+/; // only `i` and `s` are valid today,
|
|
|
|
|
const REGEX_COMBINATOR_WHITESPACE = /^\s*(\+|~|>|\|\|)\s*/;
|
|
|
|
|
const REGEX_COMBINATOR = /^(\+|~|>|\|\|)/;
|
|
|
|
|
const REGEX_PERCENTAGE = /^\d+(\.\d+)?%/;
|
|
|
|
|
const REGEX_NTH_OF = /^(even|odd|(-?[0-9]?n?(\s*\+\s*[0-9]+)?))(\s+of\s+)?/;
|
|
|
|
|
const REGEX_NTH_OF = /^\s*(even|odd|(-?[0-9]?n?(\s*\+\s*[0-9]+)?))(\s*(?=[,)])|\s+of\s+)/;
|
|
|
|
|
const REGEX_WHITESPACE_OR_COLON = /[\s:]/;
|
|
|
|
|
const REGEX_BRACE_OR_SEMICOLON = /[{;]/;
|
|
|
|
|
const REGEX_LEADING_HYPHEN_OR_DIGIT = /-?\d/;
|
|
|
|
@ -294,7 +294,7 @@ function read_selector(parser, inside_pseudo_class = false) {
|
|
|
|
|
start,
|
|
|
|
|
end: parser.index
|
|
|
|
|
});
|
|
|
|
|
} else if (parser.match_regex(REGEX_NTH_OF)) {
|
|
|
|
|
} else if (inside_pseudo_class && parser.match_regex(REGEX_NTH_OF)) {
|
|
|
|
|
children.push({
|
|
|
|
|
type: 'Nth',
|
|
|
|
|
value: /** @type {string} */ (parser.read(REGEX_NTH_OF)),
|
|
|
|
|