Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /shadow-dom/inserting-fragment-under-shadow-host.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<html>
<body>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
promise_test(() => {
const host = document.createElement('span');
document.body.appendChild(host);
const shadowRoot = host.attachShadow({mode: 'closed'});
shadowRoot.innerHTML = '<slot></slot>';
let slotchangeDidFire = false;
shadowRoot.querySelector('slot').addEventListener('slotchange', () => slotchangeDidFire = true);
host.innerHTML = '<span slot="unused"></span>b<span slot="unused"></span>';
return new Promise((resolve) => {
queueMicrotask(() => {
assert_true(slotchangeDidFire);
host.remove();
resolve();
});
})
}, 'This tests inserting a document fragment with a mixture of elements and text nodes, which should dispatch a `slotchange` event.');
</script>
</body>
</html>