Skip to content

Fix cross-realm NodeList detection - #46

Merged
joeldrapper merged 1 commit into
mainfrom
fix-cross-realm-nodelist
May 22, 2026
Merged

Fix cross-realm NodeList detection#46
joeldrapper merged 1 commit into
mainfrom
fix-cross-realm-nodelist

Conversation

@joeldrapper

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings May 22, 2026 10:59

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes morph handling when the to argument is a NodeList originating from a different JS realm (e.g., an <iframe>), where instanceof NodeList can fail.

Changes:

  • Replace instanceof NodeList with a cross-realm-safe isNodeList type guard based on Object.prototype.toString.
  • Add a browser test that morphs using template.content.childNodes created inside an iframe document.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
test/new/cross-realm.browser.test.ts Adds a regression test covering cross-realm NodeList inputs.
src/morphlex.ts Uses a cross-realm-safe NodeList detection helper during morph dispatch.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@joeldrapper
joeldrapper merged commit 393c993 into main May 22, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants