-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
fix: treat CSS attribute selectors as case-insensitive for HTML enumerated attributes #17712
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
Merged
Rich-Harris
merged 3 commits into
sveltejs:main
from
veeceey:fix/issue-17207-css-attribute-case-insensitive
Feb 17, 2026
Merged
Changes from 1 commit
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| 'svelte': patch | ||
| --- | ||
|
|
||
| fix: treat CSS attribute selectors as case-insensitive for HTML enumerated attributes | ||
|
|
||
| CSS attribute selectors for HTML enumerated attributes (like `method`, `type`, `dir`, etc.) should match case-insensitively, matching browser behavior. Previously, `form[method="get"]` would not match `<form method="GET">`, causing the selector to be incorrectly pruned as unused and the scoping class to not be applied. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
packages/svelte/tests/css/samples/attribute-selector-html-case-insensitive/expected.css
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| form[method="get"].svelte-xyz h1:where(.svelte-xyz) { | ||
| color: red; | ||
| } | ||
|
|
||
| form[method="post"].svelte-xyz h1:where(.svelte-xyz) { | ||
| color: blue; | ||
| } | ||
|
|
||
| input[type="text"].svelte-xyz { | ||
| color: green; | ||
| } |
1 change: 1 addition & 0 deletions
1
packages/svelte/tests/css/samples/attribute-selector-html-case-insensitive/expected.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| <form class="svelte-xyz" method="GET"><h1 class="svelte-xyz">Hello</h1></form> <form class="svelte-xyz" method="POST"><h1 class="svelte-xyz">World</h1></form> <input class="svelte-xyz" type="Text" /> |
23 changes: 23 additions & 0 deletions
23
packages/svelte/tests/css/samples/attribute-selector-html-case-insensitive/input.svelte
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| <form method="GET"> | ||
| <h1>Hello</h1> | ||
| </form> | ||
|
|
||
| <form method="POST"> | ||
| <h1>World</h1> | ||
| </form> | ||
|
|
||
| <input type="Text" /> | ||
|
|
||
| <style> | ||
| form[method="get"] h1 { | ||
| color: red; | ||
| } | ||
|
|
||
| form[method="post"] h1 { | ||
| color: blue; | ||
| } | ||
|
|
||
| input[type="text"] { | ||
| color: green; | ||
| } | ||
| </style> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.