Skip to content

Declarative Shadow DOM #501

Closed
Closed

Description

@mfreed7

Description

Declarative Shadow DOM is a declarative API that allows the creation of shadow roots using only HTML and no Javascript. This API allows Web Components that use Shadow DOM to make use of Server-Side Rendering (SSR), to get rendered content on screen quickly without requiring Javascript for shadow root attachment.

Specification

whatwg/html#5465

Open Issues

whatwg/dom#831

Tests

https://wpt.fyi/results/shadow-dom/declarative?label=master&label=experimental&aligned&view=subtest

Current Implementations

  • Blink
  • Gecko
  • WebKit

Standards Positions

This is implemented and shipped in Blink, and WebKit. Gecko is positive and implementing.

Browser bug reports

https://crbug.com/1379513

Developer discussions

No response

Polls & Surveys

No response

Existing Usage

https://chromestatus.com/metrics/feature/timeline/popularity/3196

Workarounds

No response

Accessibility Impact

No response

Privacy Impact

No response

Other

No response

Activity

  1. foolip commented on Oct 5, 2023

    @foolip
    Member

    For survey data and web developer demand, in preliminary results from State of HTML 2023, Declarative Shadow DOM was a common response to the freeform question "Which existing HTML features or browser APIs are you unable to use because of browser differences or lack of support?"

  2. foolip commented on Oct 5, 2023

    @foolip
    Member

    Shadow DOM, ElementInternals and Custom Elements were also a somewhat common responses.

  3. foolip commented on Oct 25, 2023

    @foolip
    Member

    From State of HTML preliminary results, Declarative Shadow DOM was among the features that respondents expressed the most interest for. Note that this wasn't freeform, it's based on the features the survey asked about experience and sentiment for.

  4. gsnedders commented on Nov 7, 2023

    @gsnedders
    Member

    What's the status of https://github.com/web-platform-tests/wpt/blob/master/shadow-dom/declarative/getinnerhtml.tentative.html? The test links to whatwg/dom#831, but as Declarative Shadow DOM landed there's no getInnerHTML, and there doesn't seem to be any open issue asking for it to be added.

    On the face of it, we should replace that test with a historical test that getInnerHTML isn't supported.

  5. mfreed7 commented on Nov 11, 2023

    @mfreed7
    Author

    What's the status of https://github.com/web-platform-tests/wpt/blob/master/shadow-dom/declarative/getinnerhtml.tentative.html? The test links to whatwg/dom#831, but as Declarative Shadow DOM landed there's no getInnerHTML, and there doesn't seem to be any open issue asking for it to be added.

    On the face of it, we should replace that test with a historical test that getInnerHTML isn't supported.

    whatwg/html#8867 is the issue discussing getInnerHTML.

  6. gsnedders commented on Nov 16, 2023

    @gsnedders
    Member

    What's the status of https://github.com/web-platform-tests/wpt/blob/master/shadow-dom/declarative/getinnerhtml.tentative.html? The test links to whatwg/dom#831, but as Declarative Shadow DOM landed there's no getInnerHTML, and there doesn't seem to be any open issue asking for it to be added.
    On the face of it, we should replace that test with a historical test that getInnerHTML isn't supported.

    whatwg/html#8867 is the issue discussing getInnerHTML.

    Ah, okay, so it's an ongoing open issue; I'd clearly misunderstood (and somehow failed to find that issue!).

  7. gsnedders commented on Nov 16, 2023

    @gsnedders
    Member

    Several of the tests (/shadow-dom/declarative/declarative-shadow-dom-attachment.html, /shadow-dom/declarative/declarative-shadow-dom-basic.html) rely on Element.prototype.setHTMLUnsafe and Document.prototype.parseHTMLUnsafe.

    This probably isn't really part of Declarative Shadow DOM, and there's no good reason for the tests to rely on these; the tests were only changed to rely on these functions in web-platform-tests/wpt#41704, which effectively reduced test coverage of Declarative Shadow DOM for Firefox and Safari (as they now all fail before running the actual test).

    See web-platform-tests/wpt#43202 to partially revert that.

  8. mfreed7 commented on Nov 16, 2023

    @mfreed7
    Author

    Several of the tests (/shadow-dom/declarative/declarative-shadow-dom-attachment.html, /shadow-dom/declarative/declarative-shadow-dom-basic.html) rely on Element.prototype.setHTMLUnsafe and Document.prototype.parseHTMLUnsafe.

    This probably isn't really part of Declarative Shadow DOM, and there's no good reason for the tests to rely on these; the tests were only changed to rely on these functions in web-platform-tests/wpt#41704, which effectively reduced test coverage of Declarative Shadow DOM for Firefox and Safari (as they now all fail before running the actual test).

    See web-platform-tests/wpt#43202 to partially revert that.

    I'm ok with doing that, but it'll take (a lot!) more work. You'll have to manually recursively traverse into shadow roots and serialize the whole tree yourself.

    This is precisely why I really wanted to get setHTMLUnsafe and parseHTMLUnsafe landed in the spec before we landed declarative shadow DOM. It's basically required to use the feature. I'd consider them dependent features.

  9. dandclark commented on Feb 1, 2024

    @dandclark
    Contributor

    This proposal has been accepted as part of Interop 2024! On behalf of the entire Interop team, thank you for proposing it. You’ll be able to track progress on this topic throughout the year via the Interop 2024 dashboard.

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

    focus-area-proposal

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions