@@ -489,7 +489,7 @@ test("toggle(Function, Function, ...)", function() {
489489} ) ;
490490
491491test ( ".live()/.die()" , function ( ) {
492- expect ( 49 ) ;
492+ expect ( 52 ) ;
493493
494494 var submit = 0 , div = 0 , livea = 0 , liveb = 0 ;
495495
@@ -561,6 +561,24 @@ test(".live()/.die()", function() {
561561 jQuery ( "div" ) . die ( "click" ) ;
562562 jQuery ( "div" ) . die ( "submit" ) ;
563563
564+ // Test binding with a different context
565+ var clicked = 0 , container = jQuery ( '#main' ) [ 0 ] ;
566+ jQuery ( "#foo" , container ) . live ( "click" , function ( e ) { clicked ++ ; } ) ;
567+ jQuery ( "div" ) . trigger ( 'click' ) ;
568+ jQuery ( "#foo" ) . trigger ( 'click' ) ;
569+ jQuery ( "#main" ) . trigger ( 'click' ) ;
570+ jQuery ( "body" ) . trigger ( 'click' ) ;
571+ equals ( clicked , 2 , "live with a context" ) ;
572+
573+ // Make sure the event is actually stored on the context
574+ ok ( jQuery . data ( container , "events" ) . live , "live with a context" ) ;
575+
576+ // Test unbinding with a different context
577+ jQuery ( "#foo" , container ) . die ( "click" ) ;
578+ jQuery ( "#foo" ) . trigger ( 'click' ) ;
579+ equals ( clicked , 2 , "die with a context" ) ;
580+
581+
564582 // Verify that return false prevents default action
565583 jQuery ( "#anchor2" ) . live ( "click" , function ( ) { return false ; } ) ;
566584 var hash = window . location . hash ;
0 commit comments