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.
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.
more robust object type checks, taken from jQuery
This fixes operating on DOM elements within iframe.
* John Resig
* John-David Dalton
* Rafaël Blais Masson
* Robert Katić
* Ariel Flesler
Fixed! Thanks for the report