-
Notifications
You must be signed in to change notification settings - Fork 24
Description
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.