Open andruud opened 4 months ago
OK, I now see the attribute value needs to be a single token (surprising), which means the example in the first post was bad.
In that case, what about:
<div data-x="10.000px">
div { --x: attr(data-x length); }
Does this serialize as 10px
or 10.000px
?
Agenda+ on behalf of @tursunova.
IIRC, the "single token" thing was written in back in the day to simplify implementation; for whatever reason, impls didn't want to invoke their full CSS parser on attribute values. (Similarly, the color
type is restricted to just hex colors and color name keywords.)
I suspect that whatever reasons impls had for avoiding that at the time are probably less pressing now, and we should just invoke the CSS parser normally? We invoke the CSS parser for a few other HTML attributes already anyway, like <meta name=color-scheme>
or <img srcset>
What do you get if you serialize the computed value of
--x
here?I think we expect eager simplification (
3px
), and generally we may need something like the equivalent token sequence (but for non-computed values)?