-
-
Couldn't load subscription status.
- Fork 260
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
Node.getRootNode({ composed: false }) retunrs the Node itself instead of the ShadowRoot if we do not add the ShadowRoot into the document.
To Reproduce
import { expect, test } from "vitest";
test("ShadowRoot", () => {
const host = document.createElement("div");
const child = document.createElement("span");
const shadowRoot = host.attachShadow({ mode: "open" });
shadowRoot.append(child);
// It works if we uncomment this line
// document.body.append(host);
// It becomes a span if the `host` is not added to the `document`
const root = child.getRootNode({ composed: false }); // Supposed to return the ShadowRoot
expect(root).toBe(shadowRoot);
});Expected behavior
Test should be passed
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working