Skip to content

Conversation

@karlseguin
Copy link
Collaborator

The previous implementation just checked if a node had a parent. But it should check the node has a document ancestor:

const d1 = document.createElement('div');
document.createElement('div').appendChild(d1);
d1.isConnected

should be false.

In addition to this fix, also added support for DocumentFragments which are part of the ShadowRoot. This, like events, is one of those apis that DOES break the ShadowRoot isolation.

The previous implementation just checked if a node had a parent. But it should
check the node has a document ancestor:

```
const d1 = document.createElement('div');
document.createElement('div').appendChild(d1);
d1.isConnected
```

should be `false`.

In addition to this fix, also added support for DocumentFragments which are
part of the ShadowRoot. This, like events, is one of those apis that DOES break
the ShadowRoot isolation.
@karlseguin karlseguin merged commit 4758456 into main Aug 12, 2025
16 of 18 checks passed
@karlseguin karlseguin deleted the node_isConnected branch August 12, 2025 10:17
@github-actions github-actions bot locked and limited conversation to collaborators Aug 12, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants