Skip to content

Constructable Stylesheets & adoptedStyleSheets #204

Closed

Description

@Westbrook

Description

Constructable Stylesheets and adoptedStyleSheets enable adding styles directly to DOM trees, e.g. document and shadow roots, without creating new DOM elements. Because a single stylesheet object can be adopted by multiple scopes, it also allows sharing of styles that can be centrally modified.

General consensus; shipped in both Chrome and Firefox, not available in Safari

Rationale

  • There is no effective way to share styles across components while allowing them to be centrally modified.
  • Creating <style> elements for each style used in each shadow root has a measurable performance overhead.
  • CSS Module Scripts, another critical feature, depends on constructible stylesheets.

Specification

https://w3c.github.io/csswg-drafts/cssom-1/

Tests

Those including "constructable" in https://github.com/web-platform-tests/wpt/tree/master/css/cssom

Activity

  1. moved this to Proposed in Interop 2023on Oct 12, 2022
  2. Westbrook commented on Oct 15, 2022

    @Westbrook
    Author

    Interesting.

    For my understanding, "csswg-drafts" feels less official, is that just my interpretation, or does this difference actually say something about the progress of this spec at large?

  3. gsnedders commented on Oct 16, 2022

    @gsnedders
    Member

    Interesting.

    For my understanding, "csswg-drafts" feels less official, is that just my interpretation, or does this difference actually say something about the progress of this spec at large?

    In principle the WICG is a group in which specifications are incubated, which then get moved into a working group (such as the CSS WG) which standardises them.

  4. foolip commented on Nov 11, 2022

    @foolip
    Member

    In the MDN short survey on APIs & JavaScript, "Web Components (custom elements, Shadow DOM, etc.)" was the most popular choice by a fairly wide margin, selected by ~39% of survey takers.

    Web Components was split into many granular proposals, and the survey results don't tell us which aspects web developers want the most, but it's fair to say that something about Web Components is important. (I'm posting this comment on each of the split proposals.)

  5. added
    accepted
    on Feb 1, 2023
  6. nairnandu commented on Feb 1, 2023

    @nairnandu
    Contributor

    Thank you for proposing Constructable Stylesheets & adoptedStyleSheets for inclusion in Interop 2023.

    We are pleased to let you know that this proposal was accepted as part of the Web Components focus area. You can follow the progress of this Focus Area on the Interop 2023 dashboard.

    For an overview of our process, see the proposal selection summary. Thank you for contributing to Interop 2023!

    Posted on behalf of the Interop team.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    acceptedfocus-area-proposal

    Type

    No type

    Projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions