diff --git a/demos/accordion/custom-icons.html b/demos/accordion/custom-icons.html index 91ca4543a..9d43c3c8b 100644 --- a/demos/accordion/custom-icons.html +++ b/demos/accordion/custom-icons.html @@ -19,7 +19,7 @@ $( "#accordion" ).accordion({ icons: icons }); - $( "#toggle" ).button().click(function() { + $( "#toggle" ).button().on( "click", function() { if ( $( "#accordion" ).accordion( "option", "icons" ) ) { $( "#accordion" ).accordion( "option", "icons", null ); } else { diff --git a/demos/accordion/hoverintent.html b/demos/accordion/hoverintent.html index dce8a8f0c..ad15721f3 100644 --- a/demos/accordion/hoverintent.html +++ b/demos/accordion/hoverintent.html @@ -23,10 +23,10 @@ */ $.event.special.hoverintent = { setup: function() { - $( this ).bind( "mouseover", jQuery.event.special.hoverintent.handler ); + $( this ).on( "mouseover", jQuery.event.special.hoverintent.handler ); }, teardown: function() { - $( this ).unbind( "mouseover", jQuery.event.special.hoverintent.handler ); + $( this ).off( "mouseover", jQuery.event.special.hoverintent.handler ); }, handler: function( event ) { var currentX, currentY, timeout, @@ -42,8 +42,8 @@ function clear() { target - .unbind( "mousemove", track ) - .unbind( "mouseout", clear ); + .off( "mousemove", track ) + .off( "mouseout", clear ); clearTimeout( timeout ); } @@ -75,7 +75,7 @@ } timeout = setTimeout( handler, 100 ); - target.bind({ + target.on({ mousemove: track, mouseout: clear }); diff --git a/tests/unit/accordion/core.js b/tests/unit/accordion/core.js index b1d45f77e..0a3931162 100644 --- a/tests/unit/accordion/core.js +++ b/tests/unit/accordion/core.js @@ -38,7 +38,7 @@ $.each( { div: "#list1", ul: "#navigation", dl: "#accordion-dl" }, function( typ test( "handle click on header-descendant", function() { expect( 1 ); var element = $( "#navigation" ).accordion(); - $( "#navigation h2:eq(1) a" ).click(); + $( "#navigation h2:eq(1) a" ).trigger( "click" ); state( element, 0, 1, 0 ); }); diff --git a/tests/unit/accordion/events.js b/tests/unit/accordion/events.js index 7f7390c83..fef1a0aac 100644 --- a/tests/unit/accordion/events.js +++ b/tests/unit/accordion/events.js @@ -82,7 +82,7 @@ test( "beforeActivate", function() { strictEqual( ui.newPanel[ 0 ], content[ 1 ] ); state( element, 1, 0, 0 ); }); - headers.eq( 1 ).click(); + headers.eq( 1 ).trigger( "click" ); state( element, 0, 1, 0 ); element.one( "accordionbeforeactivate", function( event, ui ) { @@ -142,7 +142,7 @@ test( "activate", function() { equal( ui.newPanel.length, 1 ); strictEqual( ui.newPanel[ 0 ], content[ 1 ] ); }); - headers.eq( 1 ).click(); + headers.eq( 1 ).trigger( "click" ); element.one( "accordionactivate", function( event, ui ) { equal( ui.oldHeader.length, 1 ); diff --git a/tests/unit/accordion/options.js b/tests/unit/accordion/options.js index c95738c43..52d54ed32 100644 --- a/tests/unit/accordion/options.js +++ b/tests/unit/accordion/options.js @@ -60,7 +60,7 @@ test( "{ active: Number }", function() { equal( element.accordion( "option", "active" ), 0 ); state( element, 1, 0, 0 ); - element.find( ".ui-accordion-header" ).eq( 1 ).click(); + element.find( ".ui-accordion-header" ).eq( 1 ).trigger( "click" ); equal( element.accordion( "option", "active" ), 1 ); state( element, 0, 1, 0 ); @@ -269,7 +269,7 @@ test( "{ collapsible: false }", function() { equal( element.accordion( "option", "active" ), 1 ); state( element, 0, 1, 0 ); - element.find( ".ui-accordion-header" ).eq( 1 ).click(); + element.find( ".ui-accordion-header" ).eq( 1 ).trigger( "click" ); equal( element.accordion( "option", "active" ), 1 ); state( element, 0, 1, 0 ); }); @@ -289,7 +289,7 @@ test( "{ collapsible: true }", function() { equal( element.accordion( "option", "active" ), 1 ); state( element, 0, 1, 0 ); - element.find( ".ui-accordion-header" ).eq( 1 ).click(); + element.find( ".ui-accordion-header" ).eq( 1 ).trigger( "click" ); equal( element.accordion( "option", "active" ), false ); state( element, 0, 0, 0 ); }); @@ -306,7 +306,7 @@ test( "{ event: null }", function() { state( element, 0, 1, 0 ); // ensure default click handler isn't bound - element.find( ".ui-accordion-header" ).eq( 2 ).click(); + element.find( ".ui-accordion-header" ).eq( 2 ).trigger( "click" ); equal( element.accordion( "option", "active" ), 1 ); state( element, 0, 1, 0 ); }); diff --git a/ui/accordion.js b/ui/accordion.js index 646352715..a9b843cd5 100644 --- a/ui/accordion.js +++ b/ui/accordion.js @@ -217,14 +217,14 @@ return $.widget( "ui.accordion", { if ( toFocus ) { $( event.target ).attr( "tabIndex", -1 ); $( toFocus ).attr( "tabIndex", 0 ); - toFocus.focus(); + $( toFocus ).trigger( "focus" ); event.preventDefault(); } }, _panelKeyDown: function( event ) { if ( event.keyCode === $.ui.keyCode.UP && event.ctrlKey ) { - $( event.currentTarget ).prev().focus(); + $( event.currentTarget ).prev().trigger( "focus" ); } },