w3c / csswg-drafts

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

[css-selectors] Be able to select for partial attribute names #8632

Open keithamus opened 1 year ago

keithamus commented 1 year ago

It can be useful to select for partial attribute names (not values); for example trying select all elements with an aria attribute (i.e. any attribute name which matches /aria-.*/) or data attribute (/data-.*/), another example is the recent popover attributes; popovertoggletarget, popoverhidetarget, popovershowtarget - it would be useful to have on selector to find all "popover invokers" that have an attribute matching /^popover.*target$/.

I'd like to propose some way of extending the attribute selector syntax to allow for this kind of wildcard. Simple wildcards rather than regexes will likely be sufficient.

yarusome commented 1 year ago

See also https://github.com/w3c/csswg-drafts/issues/6571#issuecomment-912818277.