Re: [csswg-drafts] [css-values] Type conversion functions (#6408)

> type conversion functions may also cover type conversion in `attr()`

If we had multiple functions like that, it could make sense to do it in a generic way. But if `attr()`  is the only case, it's probably simpler to just keep the 2nd parameter.

> Any string that can be interpreted as a valid `<number>` value [...] to surrounding whitespace I'd say no

Well, if it's parsing as `<number>`, then I would expect to use https://www.w3.org/TR/css-syntax-3/#parse-a-component-value and ignore whitespace tokens.

> So how would you convert a string `"2em"` into a number? Should it just fail?

Yes, it should fail like in https://drafts.csswg.org/css-values-5/#valdef-attr-number
If you want to get a number, you should convert it into a length, and then use `calc()` to divide by `1em` or whatever.

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


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Sunday, 1 September 2024 15:09:30 UTC