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 6 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--) { while (i--) {
const selector = block.selectors[i]; const selector = block.selectors[i];
if (selector.type === 'PseudoElementSelector' || selector.type === 'PseudoClassSelector') { if (selector.type === 'PseudoElementSelector' || selector.type === 'PseudoClassSelector') {
if (selector.name !== 'root') {
if (i === 0) code.prependRight(selector.start, attr); if (i === 0) code.prependRight(selector.start, attr);
}
continue; continue;
} }

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

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

Loading…
Cancel
Save