Skip to content

fix: make isElement compatible with iframe elements - #3

Open
LynnDolly wants to merge 3 commits into
aidenybai:mainfrom
LynnDolly:main
Open

fix: make isElement compatible with iframe elements#3
LynnDolly wants to merge 3 commits into
aidenybai:mainfrom
LynnDolly:main

Conversation

@LynnDolly

Copy link
Copy Markdown

Summary

instanceof Element can fail for elements created in a different browsing context (e.g. iframe),
because each window has its own Element constructor.

This change updates isElement to support cross-iframe elements by:

  1. keeping the fast path for current-window elements:
    • node instanceof Element
  2. adding a fallback path:
    • resolve node.ownerDocument.defaultView.Element
    • check node instanceof ElementConstructor

Why

element-source may receive nodes from embedded documents.
Without this fallback, valid iframe elements may be treated as non-elements.

Scope

  • packages/element-source/src/utils/is-element.ts
  • no public API changes
  • behavior only improves for cross-window/iframe cases

@vercel

vercelBot commented Jul 31, 2026

Copy link
Copy Markdown

@LynnDolly is attempting to deploy a commit to the Million Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for freeto 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

@LynnDolly