summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/shadow-dom/declarative/support
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/shadow-dom/declarative/support')
-rw-r--r--testing/web-platform/tests/shadow-dom/declarative/support/declarative-child-frame.html23
-rw-r--r--testing/web-platform/tests/shadow-dom/declarative/support/helpers.js4
2 files changed, 27 insertions, 0 deletions
diff --git a/testing/web-platform/tests/shadow-dom/declarative/support/declarative-child-frame.html b/testing/web-platform/tests/shadow-dom/declarative/support/declarative-child-frame.html
new file mode 100644
index 0000000000..603c47743b
--- /dev/null
+++ b/testing/web-platform/tests/shadow-dom/declarative/support/declarative-child-frame.html
@@ -0,0 +1,23 @@
+<div id=iframe>
+ <div id=wrapper>
+ <div id=host>
+ <template shadowrootmode=open>
+ <span id=content>Content</span>
+ </template>
+ </div>
+ </div>
+</div>
+
+<script>
+function sendStatus(error, hasShadow, msg) {
+ const name = window.name;
+ parent.postMessage({ name, error, hasShadow, msg }, '*');
+}
+
+window.addEventListener('load', () => {
+ const host = document.querySelector('#host');
+ if (!host)
+ return sendStatus(true, false, 'Unable to find host element');
+ return sendStatus(false, !!host.shadowRoot);
+});
+</script>
diff --git a/testing/web-platform/tests/shadow-dom/declarative/support/helpers.js b/testing/web-platform/tests/shadow-dom/declarative/support/helpers.js
new file mode 100644
index 0000000000..0be3add620
--- /dev/null
+++ b/testing/web-platform/tests/shadow-dom/declarative/support/helpers.js
@@ -0,0 +1,4 @@
+function setInnerHTML(el,content) {
+ const fragment = (new DOMParser()).parseFromString(`<pre>${content}</pre>`, 'text/html', {includeShadowRoots: true});
+ (el instanceof HTMLTemplateElement ? el.content : el).replaceChildren(...fragment.body.firstChild.childNodes);
+}