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 -~----------~----~----~----~------~----~------~--~---