Skip to content

Commit

Permalink
Carry over AllowDeclarativeShadowRoot state when parser created via d…
Browse files Browse the repository at this point in the history
…ocument.write.

Differential Revision: https://phabricator.services.mozilla.com/D208747

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1892882
gecko-commit: c7a7a9e47f66581211046deb5ce4a4279ba3cca0
gecko-reviewers: dom-core, hsivonen
  • Loading branch information
avandolder authored and moz-wptsync-bot committed May 15, 2024
1 parent 5fe29b5 commit 74aad7d
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions shadow-dom/declarative/declarative-shadow-dom-write-to-iframe.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!DOCTYPE html>
<meta charset=utf-8>
<title>`document.write` on inner iframe handles declarative shadow DOM</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<iframe></iframe>
<script>
promise_test(async () => {
await new Promise(res => window.addEventListener("load", res));
let elem = document.querySelector("iframe");
elem.contentDocument.write(`
<div>
<template shadowrootmode="open"><slot></slot></template>
<p>Test</p>
</div>
`);
let container = elem.contentDocument.querySelector("div");
assert_true(!!container, "write should occur");
assert_true(!!container.shadowRoot, "write should create shadowroot");
assert_equals(container.innerText, "Test", "div should still contain text");
}, "`document.write` on inner iframe handles declarative shadow DOM");
</script>

0 comments on commit 74aad7d

Please sign in to comment.