recurse into :is and :where

pull/10490/head
Rich Harris 3 years ago
parent 960bea9afd
commit 53ffccd482

@ -208,6 +208,7 @@ function relative_selector_might_apply_to_node(relative_selector, node, styleshe
if (selector.type === 'PseudoClassSelector' && (name === 'host' || name === 'root')) {
return NO_MATCH;
}
if (
relative_selector.selectors.length === 1 &&
selector.type === 'PseudoClassSelector' &&
@ -216,7 +217,25 @@ function relative_selector_might_apply_to_node(relative_selector, node, styleshe
return NO_MATCH;
}
if (selector.type === 'PseudoClassSelector' || selector.type === 'PseudoElementSelector') {
if (selector.type === 'PseudoClassSelector') {
if ((name === 'is' || name === 'where') && selector.args) {
let matched = false;
for (const complex_selector of selector.args.children) {
if (apply_selector(truncate(complex_selector), node, stylesheet)) {
matched = true;
}
}
if (!matched) {
return NO_MATCH;
}
}
continue;
}
if (selector.type === 'PseudoElementSelector') {
continue;
}

Loading…
Cancel
Save