[csswg-drafts] [css-values-5] support HTML syntax such as <html-integer> in typed attr() (#12875)

dbaron has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-values-5] support HTML syntax such as <html-integer> in typed attr() ==
The [typed `attr()` spec](https://drafts.csswg.org/css-values-5/#attr-notation) allows attributes in the markup to be parsed according to CSS parsing rules and used as the values of CSS properties.  However, attributes in the document might already be defined using a syntax that is somewhat different from the CSS parsing rules, such as HTML's [rules for parsing integers](https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#rules-for-parsing-integers) which ignore unexpected characters at the end of the integer.

While these differences are often not very important if somebody is writing a style sheet to be used on their own page, they can be more important in style sheets that are meant to be applied to pages written by others.  (One significant style sheet that falls in this category is the UA style sheet!)

It seems like we might want to add support for some common attribute syntaxes that are present in HTML so that they can be used as CSS property values based on HTML's parsing rules.  Probably the two most significant examples that come to mind would be (if I take the liberty of trying to name them at the same time) [`<html-integer>`](https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#rules-for-parsing-integers) and [`<html-nonnegative-integer>`](https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#valid-non-negative-integer).

(I was thinking about this in the context of styling `<select>` elements based on their `size` attribute.  cc @josepharhar.)

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/12875 using your GitHub account


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

Received on Monday, 29 September 2025 16:34:53 UTC