Skip to content

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

@dbaron

Description

@dbaron

The typed attr() spec 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 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> and <html-nonnegative-integer>.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions