Diego, My apologies, I misunderstood you.
(Also, the test case is working now: resize the window to test it, and see that jQuery is binding one of the resize events incorrectly.) Jed Schmidt On Feb 26, 6:01 pm, Diego Perini <[email protected]> wrote: > Jed, > your test case is not accessible for me. I get "Access denied". > > Diego > > On 27 Feb, 02:21, Jed Schmidt <[email protected]> wrote: > > > The above code is just to skip processing for text nodes (nodeType == > > 3) and comments (nodeType == 8), which do not have events. > > > Windows are the only elements which lack a nodeType, but for which > > events (resize, focus) are possible. > > > Here's a better test > > case:http://s3.amazonaws.com/iframeWindowTest/index.html > > > Jed Schmidt > > > On Feb 26, 4:51 pm, Diego Perini <[email protected]> wrote: > > > > 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 <[email protected]> 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~----------~----~----~----~------~----~------~--~---
