@@ -343,13 +343,26 @@ test("bind/delegate bubbling, isDefaultPrevented", function() {
343343
344344test ( "bind(), iframes" , function ( ) {
345345 // events don't work with iframes, see #939 - this test fails in IE because of contentDocument
346- var doc = jQuery ( "#loadediframe " ) . contents ( ) ;
346+ var doc = jQuery ( "#loadedf " ) . contents ( ) ;
347347
348348 jQuery ( "div" , doc ) . bind ( "click" , function ( ) {
349349 ok ( true , "Binding to element inside iframe" ) ;
350350 } ) . click ( ) . unbind ( "click" ) ;
351351} ) ;
352352
353+ test ( "bind(), unbind events on different window" , 2 , function ( ) {
354+ // unbinding an event bound to a different window would throw an exception in IE #8870
355+ var win = window . frames [ "loadediframe" ] ,
356+ handler = function ( ) { ok ( true , "Bound to iframe window" ) ; } ;
357+ jQuery ( win ) . bind ( 'foo' , handler ) . trigger ( 'foo' ) ;
358+ try {
359+ //error would be thrown here normally, so if the assertion runs we pass
360+ jQuery ( win ) . unbind ( 'foo' , handler ) ;
361+ ok ( true , "Unbound succesfully" ) ;
362+ } catch ( e ) { }
363+ jQuery ( win ) . trigger ( 'foo' ) ;
364+ } ) ;
365+
353366test ( "bind(), trigger change on select" , function ( ) {
354367 expect ( 5 ) ;
355368 var counter = 0 ;
0 commit comments