Match attribute selector names ASCII case-insensitively - #332
Merged
orium merged 1 commit intoJul 29, 2026
Conversation
robobun
requested review from
a team,
Noah-Kennedy,
jasnell and
orium
as code owners
July 27, 2026 06:49
`[HREF]` was accepted but silently matched nothing because `Condition::from` stored `local_name` (the selector as written) instead of `local_name_lower`, while `AttributeMatcher::find` compares against lowercased element attribute names. `[HREF=x]` threw `NamespacedSelector` because the `selectors` crate emits `Component::AttributeOther` for any attribute name that isn't already ASCII-lowercase, and `validate_component` rejected every `AttributeOther` without checking whether a namespace is actually present. Fixes cloudflare#328
robobun
force-pushed
the
fix/uppercase-attribute-name-selector
branch
from
July 27, 2026 06:55
66ed25b to
a80e470
Compare
orium
approved these changes
Jul 29, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #328.
[HREF]was accepted but silently matched nothing:Condition::fromstoredlocal_name(the selector as written) whileAttributeMatcher::findcompares against lowercased element attribute names. Uselocal_name_lowerinstead.[HREF=x]threwNamespacedSelector: theselectorscrate emitsComponent::AttributeOtherfor any attribute name that isn't already ASCII-lowercase (namespace.is_some() || !local_name_is_ascii_lowercase), andvalidate_componentrejected everyAttributeOtherwithout checking whether a namespace is present. Accept it whennamespaceisNoneand lower it to the existingAttributeExists/AttributeComparisonExprexpressions usinglocal_name_lower.Selectors with an actual namespace (
[*|foo]) are still rejected.