Skip to content

Commit

Permalink
Merge pull request #660 from sveltejs/gh-658
Browse files Browse the repository at this point in the history
put attribute selector before pseudo-class selector
  • Loading branch information
Rich-Harris committed Jun 23, 2017
2 parents 1ce6cfa + b07f303 commit 02e11f5
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/generators/shared/processCss.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ export default function processCss(
shouldTransform = false;
}

else if (child.type === 'PseudoElementSelector') {
code.prependRight(c, attr);
shouldTransform = false;
}

c = child.end;
});

Expand Down
3 changes: 3 additions & 0 deletions test/css/samples/cascade-false-pseudo-element/_config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default {
cascade: false
};
12 changes: 12 additions & 0 deletions test/css/samples/cascade-false-pseudo-element/expected.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

span[svelte-583610229]::after {
content: 'i am a pseudo-element';
}

span[svelte-583610229]:first-child {
color: red;
}

span[svelte-583610229]:last-child::after {
color: blue;
}
15 changes: 15 additions & 0 deletions test/css/samples/cascade-false-pseudo-element/input.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<span></span>

<style>
span::after {
content: 'i am a pseudo-element';
}

span:first-child {
color: red;
}

span:last-child::after {
color: blue;
}
</style>

0 comments on commit 02e11f5

Please sign in to comment.