Jed,
I would like to add that a few lines above the ones you pointed out we
also have:

                if ( elem.nodeType == 3 || elem.nodeType == 8 )
                        return;

Can "elem" really be a window/frame reference ?

Shouldn't this give an error since windows/frames do not have a
"nodeType" property or am I missing the obvious ?

Diego


On 27 Feb, 00:39, Jed Schmidt <t...@nslator.jp> wrote:
> Hello all,
>
> I'm having trouble binding events to the window of a child iframe:
>
> $("<iframe/>")
>   .bind( "load", function() {
>     $( this.contentWindow ).bind( function() {
>       console.log( this == window ) // true, should be false
>   })
>   .appendTo( document.body )
>
> Basically, events bound to the window of a child frame end up being
> bound to the window in which jQuery is running. I think this might be
> because of the following section in jQuery.event.add:
>
> // For whatever reason, IE has trouble passing the window object
> // around, causing it to be cloned in the process
> if ( elem.setInterval && elem != window )
>         elem = window;
>
> This condition mistakenly triggers for child windows, because they
> have the setInterval method but are not the main window.
>
> I think this can be fixed by changing line 2587 to:
>
> if ( elem.setInterval && ( elem != window || !elem.frameElement ) )
>         elem = window;
>
> Jed Schmidt
>
> PS: Also, after doing some iframe-related work, I have a few ideas
> about making jQuery more intuitive:
>
> (1) $.fn.html should have a case for iframes that calls open/write/
> close for the frame's document, enabling $("<iframe/>").html
> ("<html><body>Hello world</body></html>")
>
> (2) $.fn.parent and $.fn.children should work for windows, returning
> their child/parent windows where possible.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to jquery-dev@googlegroups.com
To unsubscribe from this group, send email to 
jquery-dev+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to