← Back to release summary

Declarative shadow DOM serialization

Category
DOM
Type
New or changed feature
Status
In developer trial (Behind a flag) (Chrome 125)
Intent stage
None

Summary

The prototype implementation (which was shipped in 2020 and then shape-changed in 2023) contained a method called `getInnerHTML()` that could be used to serialize DOM trees containing shadow roots. That part of the prototype was not standardized with the rest of declarative shadow dom, and only recently has it reached spec consensus (https://github.com/whatwg/html/issues/8867). As part of that consensus, the shape of the getInnerHTML API changed. This feature represents the desire to ship the new, agreed-upon shape, which is: - getHTML({serializableShadowRoots:bool, shadowRoots:[roots]}).

Motivation

This allows developers to serialize DOM trees containing shadow roots, which is otherwise a very manual process.

Standards & signals

Explainers: https://github.com/whatwg/html/issues/8867#issuecomment-1856696628

View on chromestatus.com