Open knowler opened 8 months ago
Part of the discussion in #8726 seems related, e.g. https://github.com/w3c/csswg-drafts/issues/8726#issuecomment-1565754235
Using
all
, but being able to specify exceptions, perhaps, as subsequent values in the existing syntax
Shorthand declaration need to be expanded into longhand declarations at parse time. Thus the list of longhands shouldn't be based on the provided value, which is not known until computed-value time (e.g. there could be a var()
).
Currently there is no in-between API for setting a list of properties to the same value: it’s either
all
or setting each individual property. It would be nice to have more granular shorthands:all
, but being able to specify exceptions, perhaps, as subsequent values in the existing syntax (e.g.all: revert-layer not background-color, color
).In the Shadow DOM, this would be helpful when exposing shadow parts or for styling slotted content or even the shadow host. Currently, if I want to limit my element’s CSS API, I have to either set each of those properties to
!important
or setall: revert-layer !important
in my unlayered styles, then use custom properties for each property:Outside of the Shadow DOM, this is also helpful in a layered stylesheet since one might want to prevent a subsequent layers from styling certain properties on an element. The existing technique to do this is the same one I demonstrated for the Shadow DOM above (I also have an article explaining this technique).