WICG / turtledove

TURTLEDOVE
https://wicg.github.io/turtledove/
Other
521 stars 225 forks source link

Simplify ad size parsing #644

Open jyasskin opened 1 year ago

jyasskin commented 1 year ago

https://wicg.github.io/turtledove/#parse-an-adrender-dimension-value should use [=CSS/parse=] as a <<dimension-token>>. This would shorten the spec regardless of the outcome of #643, since that parsing step doesn't validate the unit values.

@tabatkins, can they use <<dimension-token>> to accept unitless values, or do they need to say it's either a <<dimension-token>> or a <<number-token>>? The railroad diagram seems to say that <<dimension-token>>s always have the unit, but those diagrams are also described as non-normative and I can't find the normative definition we'd pass to CSS/parse.

tabatkins commented 1 year ago

No, unitless values are <<number-token>>. So you can ask to parse as <<dimension-token>> | <<number-token>>, or just do the two parses yourself and check for failure between.