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

pull/7738/head
Tan Li Hau 5 years ago committed by GitHub
parent 849aa7b7d8
commit 065b6a16bd

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