Merge pull request #3250 from davemo/fix/1705-root-pseudo-selector-prefix-exemption

bugfix: exempt the :root psuedo-selector from the random css prefix
pull/3219/head
Rich Harris 5 years ago committed by GitHub
commit 8c1f48f828
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -62,7 +62,9 @@ export default class Selector {
while (i--) {
const selector = block.selectors[i];
if (selector.type === 'PseudoElementSelector' || selector.type === 'PseudoClassSelector') {
if (i === 0) code.prependRight(selector.start, attr);
if (selector.name !== 'root') {
if (i === 0) code.prependRight(selector.start, attr);
}
continue;
}

@ -1 +1 @@
div.svelte-xyz{--test:10}
:root{--root-test:20}div.svelte-xyz{--test:10}

@ -1,7 +1,10 @@
<div></div>
<style>
:root {
--root-test: 20;
}
div {
--test: 10;
}
</style>
</style>

Loading…
Cancel
Save