Skip to content

Spec requires adopted stylesheets to be included in styleSheets property but doesn't require them to be used for styling #118

@othermaciej

Description

@othermaciej

The spec requires adopted stylesheets to also be included in styleSheets property, apparently inadvertently.

The Constructable Stylesheets spec says:

The user agent must include all style sheets in the DocumentOrShadowRoot's adopted stylesheets inside its document or shadow root CSS style sheets. [1]

The phrase "document or shadow root CSS style sheets" links to the definition of that term in CSSOM (thus effectively monkeypatching CSSOM, since the CSSOM definition is written as if all stylesheets come from <style> or <link rel=stylesheet> elements.

CSSOM in turn defines the styleSheets DOM property thus:

The styleSheets attribute must return a StyleSheetList collection representing the document or shadow root CSS style sheets. [2

This links to the very same definition of document or shadow root CSS style sheets. Therefore, the combination of the specs would require adopted style sheets to also appear in the styleSheets property.

Chrome does not implement this behavior. And per one of the spec authors, this was not intended.

The spec should be updated that the stylesheets will be used, but will not appear in styleSheets. I am not sure how to specify this. In fact, I'm not sure what the spec does now actually requires adopted stylesheets to be used for styling. I don't think the places that require styling even refer to this CSSOM definition. That would likey require monekypatching this spot in CSS Cascading and Inheritence. Best to ask an expert on CSS specs though.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions