[fix] improper :global() style encapsulation (#6560)

pull/6563/head
Tan Li Hau 3 years ago committed by GitHub
parent ab825ed2eb
commit b23d267f1f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -278,14 +278,12 @@ function block_might_apply_to_node(block: Block, node: Element): BlockAppliesToN
return BlockAppliesToNode.NotPossible;
}
if (selector.type === 'PseudoClassSelector' || selector.type === 'PseudoElementSelector') {
continue;
if (block.selectors.length === 1 && selector.type === 'PseudoClassSelector' && name === 'global') {
return BlockAppliesToNode.NotPossible;
}
if (selector.type === 'PseudoClassSelector' && name === 'global') {
// TODO shouldn't see this here... maybe we should enforce that :global(...)
// cannot be sandwiched between non-global selectors?
return BlockAppliesToNode.NotPossible;
if (selector.type === 'PseudoClassSelector' || selector.type === 'PseudoElementSelector') {
continue;
}
if (selector.type === 'ClassSelector') {

@ -0,0 +1,3 @@
export default {
warnings: []
};

@ -0,0 +1,9 @@
<style>
:global(div) > div {
color: red;
}
</style>
<div>
<div />
</div>
Loading…
Cancel
Save