diff options
Diffstat (limited to 'testing/web-platform/tests/shadow-dom/declarative/support/helpers.js')
-rw-r--r-- | testing/web-platform/tests/shadow-dom/declarative/support/helpers.js | 4 |
1 files changed, 4 insertions, 0 deletions
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); +} |