ladybird/Tests/LibWeb/Text/input/DOM/shadow-root-boundary-of-inserted-node-is-traversed.html
Luke Wilde 6df4e5f5e7 LibWeb: Actually traverse the shadow root of the inclusive descendant
Previously, the inclusive descendant, which is the node that
for_each_shadow_including_inclusive_descendant was called on, would not
have it's shadow root traversed if it had one.

This is because the shadow root traversal was in the `for` loop, which
begins with the node's first child. The fix here is to move the shadow
root traversal outside of the loop, and check if the current node is an
element instead.
2024-11-13 14:40:02 +01:00

14 lines
457 B
HTML

<!DOCTYPE html>
<script src="../include.js"></script>
<script>
test(() => {
const div = document.createElement("div");
const shadowRoot = div.attachShadow({ mode: "closed" });
const script = document.createElement("script");
script.innerText = "println('Hello from script in the shadow root of the just inserted div!')";
shadowRoot.appendChild(script);
document.body.appendChild(div);
});
</script>