- From: Xiaocheng Hu via GitHub <sysbot+gh@w3.org>
- Date: Mon, 31 Jan 2022 21:52:18 +0000
- To: public-css-archive@w3.org
xiaochengh has just created a new issue for https://github.com/w3c/csswg-drafts: == [css-cascade-5] Add a R/W `CSSStyleSheet.layer` attribute for the layer name == I'm proposing extending the `CSSStyleSheet` interface with a new attribute, `layer`. On getting, it should return the layer name if the sheet is entirely in some cascade layer. In particular: - If this is an `@import`-ed stylesheet, return the `layerName` attribute value of the `CSSImportRule` - If this stylesheet is added via a `<link>` element (depending on https://github.com/whatwg/html/issues/7540), then return the name of that layer - If this is a constructed stylesheet with a layer name previous set by JS (see below), return that layer name - Otherwise, return `null` On setting: - If this is a constructed stylesheet and the new value is a non-null string, then the attribute value can be modified, and the stylesheet is treated as entirely in the given layer - Otherwise, returns `null` The primary use case is to allow adding layered constructed stylesheets, especially if the stylesheet is a 3rd party CSS module, and we want to use that to set up a web component (which we currently don't have a good way to make it layered): ```javascript import sheet from 3p-foo.css; sheet.layer = 'new-layer'; shadowRoot.adoptedStylesheets = [sheet]; ``` Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/7002 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Monday, 31 January 2022 21:52:19 UTC