Accordion: Remove core event/alias and deprecated module dependencies

This commit is contained in:
Alexander Schmitz 2015-05-13 21:52:09 -04:00
parent ad98cb1673
commit b240eed81b
6 changed files with 15 additions and 15 deletions

View File

@ -19,7 +19,7 @@
$( "#accordion" ).accordion({ $( "#accordion" ).accordion({
icons: icons icons: icons
}); });
$( "#toggle" ).button().click(function() { $( "#toggle" ).button().on( "click", function() {
if ( $( "#accordion" ).accordion( "option", "icons" ) ) { if ( $( "#accordion" ).accordion( "option", "icons" ) ) {
$( "#accordion" ).accordion( "option", "icons", null ); $( "#accordion" ).accordion( "option", "icons", null );
} else { } else {

View File

@ -23,10 +23,10 @@
*/ */
$.event.special.hoverintent = { $.event.special.hoverintent = {
setup: function() { setup: function() {
$( this ).bind( "mouseover", jQuery.event.special.hoverintent.handler ); $( this ).on( "mouseover", jQuery.event.special.hoverintent.handler );
}, },
teardown: function() { teardown: function() {
$( this ).unbind( "mouseover", jQuery.event.special.hoverintent.handler ); $( this ).off( "mouseover", jQuery.event.special.hoverintent.handler );
}, },
handler: function( event ) { handler: function( event ) {
var currentX, currentY, timeout, var currentX, currentY, timeout,
@ -42,8 +42,8 @@
function clear() { function clear() {
target target
.unbind( "mousemove", track ) .off( "mousemove", track )
.unbind( "mouseout", clear ); .off( "mouseout", clear );
clearTimeout( timeout ); clearTimeout( timeout );
} }
@ -75,7 +75,7 @@
} }
timeout = setTimeout( handler, 100 ); timeout = setTimeout( handler, 100 );
target.bind({ target.on({
mousemove: track, mousemove: track,
mouseout: clear mouseout: clear
}); });

View File

@ -38,7 +38,7 @@ $.each( { div: "#list1", ul: "#navigation", dl: "#accordion-dl" }, function( typ
test( "handle click on header-descendant", function() { test( "handle click on header-descendant", function() {
expect( 1 ); expect( 1 );
var element = $( "#navigation" ).accordion(); var element = $( "#navigation" ).accordion();
$( "#navigation h2:eq(1) a" ).click(); $( "#navigation h2:eq(1) a" ).trigger( "click" );
state( element, 0, 1, 0 ); state( element, 0, 1, 0 );
}); });

View File

@ -82,7 +82,7 @@ test( "beforeActivate", function() {
strictEqual( ui.newPanel[ 0 ], content[ 1 ] ); strictEqual( ui.newPanel[ 0 ], content[ 1 ] );
state( element, 1, 0, 0 ); state( element, 1, 0, 0 );
}); });
headers.eq( 1 ).click(); headers.eq( 1 ).trigger( "click" );
state( element, 0, 1, 0 ); state( element, 0, 1, 0 );
element.one( "accordionbeforeactivate", function( event, ui ) { element.one( "accordionbeforeactivate", function( event, ui ) {
@ -142,7 +142,7 @@ test( "activate", function() {
equal( ui.newPanel.length, 1 ); equal( ui.newPanel.length, 1 );
strictEqual( ui.newPanel[ 0 ], content[ 1 ] ); strictEqual( ui.newPanel[ 0 ], content[ 1 ] );
}); });
headers.eq( 1 ).click(); headers.eq( 1 ).trigger( "click" );
element.one( "accordionactivate", function( event, ui ) { element.one( "accordionactivate", function( event, ui ) {
equal( ui.oldHeader.length, 1 ); equal( ui.oldHeader.length, 1 );

View File

@ -60,7 +60,7 @@ test( "{ active: Number }", function() {
equal( element.accordion( "option", "active" ), 0 ); equal( element.accordion( "option", "active" ), 0 );
state( element, 1, 0, 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 ); equal( element.accordion( "option", "active" ), 1 );
state( element, 0, 1, 0 ); state( element, 0, 1, 0 );
@ -269,7 +269,7 @@ test( "{ collapsible: false }", function() {
equal( element.accordion( "option", "active" ), 1 ); equal( element.accordion( "option", "active" ), 1 );
state( element, 0, 1, 0 ); 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 ); equal( element.accordion( "option", "active" ), 1 );
state( element, 0, 1, 0 ); state( element, 0, 1, 0 );
}); });
@ -289,7 +289,7 @@ test( "{ collapsible: true }", function() {
equal( element.accordion( "option", "active" ), 1 ); equal( element.accordion( "option", "active" ), 1 );
state( element, 0, 1, 0 ); 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 ); equal( element.accordion( "option", "active" ), false );
state( element, 0, 0, 0 ); state( element, 0, 0, 0 );
}); });
@ -306,7 +306,7 @@ test( "{ event: null }", function() {
state( element, 0, 1, 0 ); state( element, 0, 1, 0 );
// ensure default click handler isn't bound // 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 ); equal( element.accordion( "option", "active" ), 1 );
state( element, 0, 1, 0 ); state( element, 0, 1, 0 );
}); });

View File

@ -217,14 +217,14 @@ return $.widget( "ui.accordion", {
if ( toFocus ) { if ( toFocus ) {
$( event.target ).attr( "tabIndex", -1 ); $( event.target ).attr( "tabIndex", -1 );
$( toFocus ).attr( "tabIndex", 0 ); $( toFocus ).attr( "tabIndex", 0 );
toFocus.focus(); $( toFocus ).trigger( "focus" );
event.preventDefault(); event.preventDefault();
} }
}, },
_panelKeyDown: function( event ) { _panelKeyDown: function( event ) {
if ( event.keyCode === $.ui.keyCode.UP && event.ctrlKey ) { if ( event.keyCode === $.ui.keyCode.UP && event.ctrlKey ) {
$( event.currentTarget ).prev().focus(); $( event.currentTarget ).prev().trigger( "focus" );
} }
}, },