Skip to content

remove :where for Svelte 5 compatibility#12

Open
zeroberry wants to merge 1 commit intozerodevx:mainfrom
zeroberry:fix/svelte5-css-specificity
Open

remove :where for Svelte 5 compatibility#12
zeroberry wants to merge 1 commit intozerodevx:mainfrom
zeroberry:fix/svelte5-css-specificity

Conversation

@zeroberry
Copy link
Copy Markdown

In Svelte 5, the CSS scoping strategy has changed. Previously, scoped styles were compiled as .xyz123:where(.class), but now they're compiled as :where(.class.xyz123). This change affects selector specificity:

  • Before: .s-_ijnsPqesdMQ:where(._jsonList) = specificity (0,0,1,0)
  • Svelte 5: :where(._jsonList.s-_ijnsPqesdMQ) = specificity (0,0,0,0)

Now the component styles can be too easily overridden by any other CSS rules, including common CSS reset utilities like

ul {
  padding: 0;
  border: 0;
}

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.

1 participant