Autocomplete: Remove core event/alias and deprecated module dependencies

This commit is contained in:
Alexander Schmitz 2015-05-13 21:54:08 -04:00
parent b240eed81b
commit 8b4ce807cd
7 changed files with 19 additions and 19 deletions

View File

@ -92,11 +92,11 @@
})
.removeClass( "ui-corner-all" )
.addClass( "custom-combobox-toggle ui-corner-right" )
.mousedown(function() {
.on( "mousedown", function() {
wasOpen = input.autocomplete( "widget" ).is( ":visible" );
})
.click(function() {
input.focus();
.on( "click", function() {
input.trigger( "focus" );
// Close if already visible
if ( wasOpen ) {
@ -165,7 +165,7 @@
$(function() {
$( "#combobox" ).combobox();
$( "#toggle" ).click(function() {
$( "#toggle" ).on( "click", function() {
$( "#combobox" ).toggle();
});
});

View File

@ -27,7 +27,7 @@
$( "#birds" )
// don't navigate away from the field on tab when selecting an item
.bind( "keydown", function( event ) {
.on( "keydown", function( event ) {
if ( event.keyCode === $.ui.keyCode.TAB &&
$( this ).autocomplete( "instance" ).menu.active ) {
event.preventDefault();

View File

@ -46,7 +46,7 @@
$( "#tags" )
// don't navigate away from the field on tab when selecting an item
.bind( "keydown", function( event ) {
.on( "keydown", function( event ) {
if ( event.keyCode === $.ui.keyCode.TAB &&
$( this ).autocomplete( "instance" ).menu.active ) {
event.preventDefault();

View File

@ -167,7 +167,7 @@ test( "allow form submit on enter when menu is not active", function() {
delay: 0,
minLength: 0
});
element.bind( "keypress", function( e ) {
element.on( "keypress", function( e ) {
didMove = !e.isDefaultPrevented();
});
element.simulate( "keydown", { keyCode: ( isKeyUp ? $.ui.keyCode.UP : $.ui.keyCode.DOWN ) } );

View File

@ -66,7 +66,7 @@ $.each([
}),
menu = element.autocomplete( "widget" );
element.simulate( "focus" )[ settings.valueMethod ]( "j" ).keydown();
element.simulate( "focus" )[ settings.valueMethod ]( "j" ).trigger( "keydown" );
setTimeout(function() {
ok( menu.is( ":visible" ), "menu is visible after delay" );
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
@ -112,10 +112,10 @@ asyncTest( "cancel search", function() {
}
}),
menu = element.autocomplete( "widget" );
element.val( "ja" ).keydown();
element.val( "ja" ).trigger( "keydown" );
setTimeout(function() {
ok( menu.is( ":hidden" ), "menu is hidden after first search" );
element.val( "java" ).keydown();
element.val( "java" ).trigger( "keydown" );
setTimeout(function() {
ok( menu.is( ":visible" ), "menu is visible after second search" );
equal( menu.find( ".ui-menu-item" ).length, 2, "# of menu items" );
@ -135,7 +135,7 @@ asyncTest( "cancel focus", function() {
return false;
}
});
element.val( "ja" ).keydown();
element.val( "ja" ).trigger( "keydown" );
setTimeout(function() {
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
equal( element.val(), customVal );
@ -154,7 +154,7 @@ asyncTest( "cancel select", function() {
return false;
}
});
element.val( "ja" ).keydown();
element.val( "ja" ).trigger( "keydown" );
setTimeout(function() {
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
element.simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } );
@ -179,7 +179,7 @@ asyncTest( "blur during remote search", function() {
ok( false, "opened after a blur" );
}
});
ac.val( "ro" ).keydown();
ac.val( "ro" ).trigger( "keydown" );
});
} );

View File

@ -87,7 +87,7 @@ function autoFocusTest( afValue, focusedLength ) {
start();
}
});
element.val( "ja" ).keydown();
element.val( "ja" ).trigger( "keydown" );
stop();
}
@ -108,7 +108,7 @@ asyncTest( "delay", function() {
delay: 25
}),
menu = element.autocomplete( "widget" );
element.val( "ja" ).keydown();
element.val( "ja" ).trigger( "keydown" );
ok( menu.is( ":hidden" ), "menu is closed immediately after search" );
@ -125,7 +125,7 @@ asyncTest( "disabled", function( assert ) {
delay: 0
}),
menu = element.autocomplete( "disable" ).autocomplete( "widget" );
element.val( "ja" ).keydown();
element.val( "ja" ).trigger( "keydown" );
ok( menu.is( ":hidden" ) );

View File

@ -233,7 +233,7 @@ $.widget( "ui.autocomplete", {
// we restore focus to ensure that the menu closes properly based on the user's
// next actions.
if ( this.element[ 0 ] !== $.ui.safeActiveElement( this.document[ 0 ] ) ) {
this.element.focus();
this.element.trigger( "focus" );
}
} );
@ -262,7 +262,7 @@ $.widget( "ui.autocomplete", {
if ( this.isNewMenu ) {
this.isNewMenu = false;
if ( event.originalEvent && /^mouse/.test( event.originalEvent.type ) ) {
this.menu.blur();
this.menu.trigger( "blur" );
this.document.one( "mousemove", function() {
$( event.target ).trigger( event.originalEvent );
@ -293,7 +293,7 @@ $.widget( "ui.autocomplete", {
// only trigger when focus was lost (click on menu)
if ( this.element[ 0 ] !== $.ui.safeActiveElement( this.document[ 0 ] ) ) {
this.element.focus();
this.element.trigger( "focus" );
this.previous = previous;
// #6109 - IE triggers two focus events and the second
// is asynchronous, so we need to reset the previous