Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardHTMLdeclarative shadow DOMSingle-choice MCQ

A page is built with `XMLHttpRequest`-fetched HTML assigned via `el.innerHTML`, and the markup contains `<div><template shadowrootmode="open">…</template></div>`. The team switches to `Document.parseHTMLUnsafe(markup)` and adopts the resulting document's body. Why does the shadow root now exist, and what does this say about where the declarative-shadow-root opt-in actually lives?

// before: el.innerHTML = markup; // div.shadowRoot === null const doc = Document.parseHTMLUnsafe(markup); const div = doc.body.querySelector('div'); // div.shadowRoot is the open root