Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

$(domnode) doesn't work for DOM nodes inside IFRAMEs #667

Closed
sciyoshi opened this Issue · 2 comments

3 participants

@sciyoshi

If you pass a DOM element from an IFRAME to the $() constructor, it fails with an error. This is because the check $.isObject does not pass, since the DOM nodes (iframe.contentDocument.head/body) are actually instances of iframe.contentWindow.Object.

@asual

I'm fighting with a very similar issue since yesterday. In my scenario I have an Ajax XML response in the top window that I pass as a reference to dynamically created iframes. When I try to select anything in that XML from inside the iframe I'm getting an error because internally the object detection fails. The reason is that the (XMLElement instanceof Object) check does not return true. It does so in the top window.

I was able to fix the issue by using top.$() instead of $() inside the iframe. Obviously it's not a nice fix. I just tried the same scenario using the latest jQuery and it works fine.

@mislav mislav closed this issue from a commit
@mislav mislav more robust object type checks, taken from jQuery
This fixes operating on DOM elements within iframe.

Fixes #667

Thanks:
* John Resig
* John-David Dalton
* Rafaël Blais Masson
* Robert Katić
* Ariel Flesler
b451f22
@mislav mislav closed this in b451f22
@mislav
Collaborator

Fixed! Thanks for the report

@lopper lopper referenced this issue from a commit in buddydvd/zepto
@mislav mislav more robust object type checks, taken from jQuery
This fixes operating on DOM elements within iframe.

Fixes #667

Thanks:
* John Resig
* John-David Dalton
* Rafaël Blais Masson
* Robert Katić
* Ariel Flesler
cc3eea7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.