w3c / csswg-drafts

CSS Working Group Editor Drafts
https://drafts.csswg.org/
Other
4.43k stars 656 forks source link

CSS Attribute presence and value selectors - Numerical Comparison <,>,<=,>=,== bitflagsOps + inspect width, height #10401

Open wesleyolis opened 3 months ago

wesleyolis commented 3 months ago

Hi,

https://www.w3.org/TR/selectors-4/#attribute-representation

I would like to propose that additional numerical comparison and bitflag selectors be introduce, which will allow us to do a lot more advance things. Yes there are hacks counting in hex for this, but ideally we looking for simple ways to achieve our goals.

There so many times when I would like to use attribute selectors to inspect a width of something, use the abstract @component selectors potentially for this, but then all the other use cases for improving grid layouts.

Additional now with grid there so many times that I would like to change elements of display:grid layout based on a numerical seed value. forcing column breaks or row breaks, instead column dividers for groups of columns. Change the alignments styles of tailing or lead sections of a group of items in columns or rows, with later proposal that will follow. nth-attrib-of[attribselectorand value]:{ grid:1/-1; }

I would like to propose that you introduce the numerical comparison and might as well add support for bit flags while you at it then.

[attr<=val]
[attr>=val]
[attr==val]
[attr>val]
[attr<val]
[attr[bitflagop]==val] // where by 

bitflagop: &, |, exclusive XOR - [X&], exclusive XAND[X&], NOT !

Any question please ask.

Crissov commented 3 months ago

Most of this has already been mentioned in #354. The bit flag operators seem mostly new.

Don’t ask me why this hasn’t had any priority within the past dozen years.