Skip to content

[all] Can we start ignoring CSSRule.type? #4142

@tabatkins

Description

@tabatkins

The CSSRule interface has a .type attribute, using the old and busted "make it an int, then define some consts associating the int with names" pattern. This is terrible for many reasons, and we've abandoned it in new APIs.

In similar situations, SVG has switched to just having all new things use a single "unknown" value, and specifying the value properly as some string-valued attribute.

Can we do the same thing?

  • deprecate CSSRule.type, defining one new value that all new rules will use. (And CSSOM defines that, unless otherwise specified, all rules use that value, so individual specs don't have to worry about it.)
  • add a new attribute to CSSRule, provisionally named ruleName, which exposes the name of the rule as a string. Whether it's reflected as "@foo" or "foo" is unimportant, we can decide either way. (I slightly favor "@foo", as that's how most of us seem to refer to the rule in practice.)
  • close down the CSSOM Constants page on the wiki ^_^

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