@@ -7,11 +7,11 @@ module('call-remote-callbacks', {
77 } ) ) ;
88 } ,
99 teardown : function ( ) {
10- $ ( document ) . undelegate ( ' form[data-remote]' , 'ajax:beforeSend ') ;
11- $ ( document ) . undelegate ( ' form[data-remote]' , 'ajax:before ') ;
12- $ ( document ) . undelegate ( ' form[data-remote]' , 'ajax:send ') ;
13- $ ( document ) . undelegate ( ' form[data-remote]' , 'ajax:complete ') ;
14- $ ( document ) . undelegate ( ' form[data-remote]' , 'ajax:success ') ;
10+ $ ( document ) . off ( 'ajax:beforeSend' , ' form[data-remote]') ;
11+ $ ( document ) . off ( 'ajax:before' , ' form[data-remote]') ;
12+ $ ( document ) . off ( 'ajax:send' , ' form[data-remote]') ;
13+ $ ( document ) . off ( 'ajax:complete' , ' form[data-remote]') ;
14+ $ ( document ) . off ( 'ajax:success' , ' form[data-remote]') ;
1515 $ ( document ) . off ( 'ajaxStop' ) ;
1616 $ ( document ) . off ( 'iframe:loading' ) ;
1717 }
@@ -371,7 +371,7 @@ function skipIt() {
371371}
372372
373373asyncTest ( '"ajax:beforeSend" can be observed and stopped with event delegation' , 1 , function ( ) {
374- $ ( document ) . delegate ( ' form[data-remote]' , 'ajax:beforeSend ', function ( ) {
374+ $ ( document ) . on ( 'ajax:beforeSend' , ' form[data-remote]', function ( ) {
375375 ok ( true , 'ajax:beforeSend observed with event delegation' ) ;
376376 return false ;
377377 } ) ;
@@ -429,18 +429,18 @@ if(window.phantom !== undefined) {
429429}
430430
431431// IF THIS TEST IS FAILING, TRY INCREASING THE TIMEOUT AT THE BOTTOM TO > 100
432- asyncTest ( 'binding to ajax callbacks via .delegate () triggers handlers properly' , 4 , function ( ) {
432+ asyncTest ( 'binding to ajax callbacks via .on () triggers handlers properly' , 4 , function ( ) {
433433 $ ( document )
434- . delegate ( ' form[data-remote]' , 'ajax:beforeSend ', function ( ) {
434+ . on ( 'ajax:beforeSend' , ' form[data-remote]', function ( ) {
435435 ok ( true , 'ajax:beforeSend handler is triggered' ) ;
436436 } )
437- . delegate ( ' form[data-remote]' , 'ajax:send ', function ( ) {
437+ . on ( 'ajax:send' , ' form[data-remote]', function ( ) {
438438 ok ( true , 'ajax:send handler is triggered' ) ;
439439 } )
440- . delegate ( ' form[data-remote]' , 'ajax:complete ', function ( ) {
440+ . on ( 'ajax:complete' , ' form[data-remote]', function ( ) {
441441 ok ( true , 'ajax:complete handler is triggered' ) ;
442442 } )
443- . delegate ( ' form[data-remote]' , 'ajax:success ', function ( ) {
443+ . on ( 'ajax:success' , ' form[data-remote]', function ( ) {
444444 ok ( true , 'ajax:success handler is triggered' ) ;
445445 } ) ;
446446 $ ( 'form[data-remote]' ) . trigger ( 'submit' ) ;
@@ -452,7 +452,7 @@ asyncTest('binding to ajax callbacks via .delegate() triggers handlers properly'
452452
453453asyncTest ( 'binding to ajax:send event to call jquery methods on ajax object' , 2 , function ( ) {
454454 $ ( 'form[data-remote]' )
455- . on ( 'ajax:send' , function ( e , xhr ) {
455+ . bind ( 'ajax:send' , function ( e , xhr ) {
456456 ok ( true , 'event should fire' ) ;
457457 equal ( typeof ( xhr . abort ) , 'function' , 'event should pass jqXHR object' ) ;
458458 xhr . abort ( ) ;
0 commit comments