Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

css scoping breaks specificity of css rules using > #4795

Closed
insidewhy opened this issue May 7, 2020 · 3 comments · Fixed by #5399
Closed

css scoping breaks specificity of css rules using > #4795

insidewhy opened this issue May 7, 2020 · 3 comments · Fixed by #5399
Labels

Comments

@insidewhy
Copy link

insidewhy commented May 7, 2020

Here's a minimal example:

<style>
  main button {
    background-color: red;
  }

  main div >button {
    background-color: blue;
  }
</style>
<main>
  <div>
    <button type="submit">Blue</button>
  </div>
</main>

The button has color red when it clearly should be blue.

Here's the generated css which inverts the specificity of these two rules:

main.svelte-5fpo0b.svelte-5fpo0b button.svelte-5fpo0b.svelte-5fpo0b {
    background-color: red;
}

main.svelte-5fpo0b div.svelte-5fpo0b>button.svelte-5fpo0b {
    background-color: blue;
}
@insidewhy
Copy link
Author

insidewhy commented May 7, 2020

Note if I change:

main div > button

to

main div button

This works around the bug. So it seems like svelte is failing to deal with > correctly.

@insidewhy insidewhy changed the title css scoping breaks specificity of my css rules css scoping breaks specificity of css rules using > May 7, 2020
@Conduitry Conduitry added the bug label May 7, 2020
@GrygrFlzr
Copy link
Member

Note that 3.16.5 was the last version to handle this properly, and starting with 3.16.6+ it instead displays this bug, likely due to #4146 fixing #1277.

@Conduitry
Copy link
Member

This is fixed in 3.25.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants