Re: [csswg-drafts] [css-values-4] Switch advanced attr() to being var()-like (#4482)

I like it. I think it'd just suggest adding one more attr-type (called `tokens` or `auto` ?) that just doesn't do first-pass type validation (at least, nothing beyond https://drafts.csswg.org/css-syntax-3/#typedef-declaration-value), and passes the whole content of the attribute as a list of tokens. Most of the time, I think the validation by type is useful, but occasionally it may be limitting, so it could be nice to allow bypassing it, since the underlying machinery will be there anyway.

That way, you could write stuff like that:
```html
<style>
.foo { background: attr(data-light-background auto, white); }
@media (prefers-color-scheme: dark) {
  .foo { background: attr(data-dark-background auto, black);}
}
</style>
<div class=foo data-dark-background="center / contain no-repeat url("logo.svg"), #222 35% url("pattern.png");">
  …
</div>

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

Received on Friday, 13 December 2019 03:33:31 UTC