diff --git a/src/compiler/compile/css/Selector.ts b/src/compiler/compile/css/Selector.ts index bb4a29ebe3..005e5320fd 100644 --- a/src/compiler/compile/css/Selector.ts +++ b/src/compiler/compile/css/Selector.ts @@ -61,7 +61,10 @@ export default class Selector { let i = block.selectors.length; while (i--) { const selector = block.selectors[i]; - if (selector.type === 'PseudoElementSelector' || selector.type === 'PseudoClassSelector') continue; + if (selector.type === 'PseudoElementSelector' || selector.type === 'PseudoClassSelector') { + if (i === 0) code.prependRight(selector.start, attr); + continue; + } if (selector.type === 'TypeSelector' && selector.name === '*') { code.overwrite(selector.start, selector.end, attr); diff --git a/test/css/samples/not-selector/expected.css b/test/css/samples/not-selector/expected.css new file mode 100644 index 0000000000..83a819a9e0 --- /dev/null +++ b/test/css/samples/not-selector/expected.css @@ -0,0 +1 @@ +.svelte-xyz:not(.foo){color:red} \ No newline at end of file diff --git a/test/css/samples/not-selector/input.svelte b/test/css/samples/not-selector/input.svelte new file mode 100644 index 0000000000..31a880f2bb --- /dev/null +++ b/test/css/samples/not-selector/input.svelte @@ -0,0 +1,8 @@ +
foo
+ + + \ No newline at end of file