fix(compiler): drop a namespace-qualified attribute selector - #449
Open
YevheniiKotyrlo wants to merge 1 commit into
Open
fix(compiler): drop a namespace-qualified attribute selector#449YevheniiKotyrlo wants to merge 1 commit into
YevheniiKotyrlo wants to merge 1 commit into
Conversation
Selectors §6 — `[ns|att]` represents only attributes in `ns`. React Native has no namespaced props, so nothing can match, and `component.namespace` was discarded: every one of these compiled to the same query as the unqualified form and matched the unqualified set instead. An UNDECLARED prefix reaches the same path. lightningcss passes it through rather than rejecting it, and Selectors L3 §6.3.3 makes such a selector invalid, so a rule the author's own stylesheet says cannot apply was applying. `[att]`, `[|att]` and `[*|att]` are untouched — measured, the first two report no namespace and the third reports `any`, and with no namespaced props those three denote the same set.
This was referenced Sep 10, 2026
Contributor
Author
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.


Summary
component.namespaceis discarded, so a namespace-qualified attribute selector matches the unqualified set instead of nothing — including an undeclared prefix, which Selectors L3 §6.3.3 makes an invalid selector.Problem
Measured — all five forms compile to the identical query
["d", "x", "=", "a"]:[data-x='a'][|data-x='a'][*|data-x='a'][ns|data-x='a']with@namespace ns …ns[undeclared|data-x='a']The last row is the worse half: a rule the author's own stylesheet says cannot apply was applying. lightningcss reports the prefix rather than rejecting it, so dropping it is this compiler's job.
Solution
A specific namespace can never match, because no React Native prop carries one — so the selector is dropped, at both attribute build sites.
The first three rows are untouched and stay correct for a reason worth stating: with no namespaced props in the tree, "no namespace" and "any namespace" denote the same set, so
[*|att]needs no special handling.Test plan
Five cases in
src/__tests__/native/attributes.test.tsx— the three that must keep matching, plus a declared and an undeclared prefix. Mutation-proved: making the predicatefalseturns exactly the last two red.yarn typecheckandyarn lintclean;yarn test1053 passed, 3 failed, 21 skipped. The three failures are two babel suites that fail identically on an untouchedmainworktree (Windows-only module-specifier rewrites) — this touches no babel file.Note
Independent of #447 and #448, though all three touch the same two build sites — whichever lands last needs a trivial rebase.