Skip to content

[cssom] Add supportsText to StyleSheet and handle HTML <link media="supports()"> #9361

@zcorpan

Description

@zcorpan

In whatwg/html#7658 by @mirisuzanne the media attribute for <link rel=stylesheet> is changed to take an import condition (rather than a media query list), but I think that requires changes to CSSOM to work:

For <link rel=stylesheet media=...> the media attribute is used in the CSSOM "create a CSS stylesheet" steps and a MediaList object gets created from the attribute's value, where that vaule is parsed as a media query list.

Meanwhile, for @import, the CSSImportRule interface has a supportsText attribute for the <supports-condition> part.

I think CSSOM needs to change to allow creating stylesheets with supports conditions, and changing the HTML media attribute needs to update both the MediaList's mediaText and the StyleSheet's supportsText. I'll file an issue for CSSOM.

(Maybe also CSSStyleSheetInit (options for constructable stylesheets) should support supports, but that's not blocking this PR.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    HTMLRequires coordination with HTML peoplecssom-1Current Work

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions