Skip to content

bugfix: exempt the :root psuedo-selector from the random css prefix#3250

Merged
Rich-Harris merged 1 commit intosveltejs:masterfrom
davemo:fix/1705-root-pseudo-selector-prefix-exemption
Jul 23, 2019
Merged

bugfix: exempt the :root psuedo-selector from the random css prefix#3250
Rich-Harris merged 1 commit intosveltejs:masterfrom
davemo:fix/1705-root-pseudo-selector-prefix-exemption

Conversation

@davemo
Copy link
Copy Markdown
Contributor

@davemo davemo commented Jul 15, 2019

  • the change in :not(...) styles are broken #1705 introduced a small bug for users who were relying on assigning global CSS variables via the :root selector
  • this change adds a small exemption to avoid prefixing the :root pseudo-selector with the random prefix that svelte adds

here is a screenshot that illustrates the bug (pre 3.6.3 [working], post 3.6.3 [broken]), and the corresponding source in my App.svelte component file:

<style>
  :root {
    --unchecked-box: '\02610';
    --checked-box: '\02611';
    --snowman: '\02603';
  }
</style>

Screen Shot 2019-07-15 at 6 55 59 PM

- the change in #1705 introduced a small bug for users who were relying on assigning global CSS variables via the :root selector
- this change adds a small exemption to avoid prefixing :root with the random prefix that svelte adds
@davemo davemo changed the title bugfix: exempt the :root selector from prefix bugfix: exempt the :root psuedo-selector from the random css prefix Jul 15, 2019
@Rich-Harris Rich-Harris merged commit 8c1f48f into sveltejs:master Jul 23, 2019
@Rich-Harris
Copy link
Copy Markdown
Member

Thanks — the purist in me chafes at treating :root differently to other pseudo-classes, but the pragmatist can't see any reason you wouldn't want this behaviour

@davemo davemo deleted the fix/1705-root-pseudo-selector-prefix-exemption branch July 25, 2019 03:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants