Re: [csswg-drafts] [css-selectors] add numeric comparisons on attribute values (#5890)

@romainmenke 
> The same is true for dimension and function tokens, those are also invalid today.
So I am unsure where the extra complexity is that you see?

I think you misunderstood my comment. I was saying that, since numeric values in attr selectors are today invalid, it's *perfectly fine* for us to allow `[foo = 5]` and have it be a *numeric* comparison rather than a string comparison, like `[foo="5"]` is today.

@Crissov 
> A [quick test](https://codepen.io/Crissov-the-bold/pen/ByKwJVm) reveals that @tabatkins is not only correct in theory but in practice, too (at least unless the CSS token starts with a letter).

Yeah, if the token starts with a letter it's an ident, which is valid (and we test string equality against its representation).

@LeaVerou 
> Adding support for dimensions adds a lot of complexity it for what seems like little benefit to me, and encourages problematic patterns.

I echo Romain's request for details here. What do you imagine is complicated here by using the MQ simplifications on both attr value and test value, and then requiring unit matches?

> For dimensions, there's always the hack outlined in https://github.com/w3c/csswg-drafts/issues/354

I reread the thread and can't figure out what hack you're referring to, could you elaborate?

-- 
GitHub Notification of comment by tabatkins
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/5890#issuecomment-3994252059 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Tuesday, 3 March 2026 23:42:01 UTC