})
.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 ) {
$(function() {
$( "#combobox" ).combobox();
- $( "#toggle" ).click(function() {
+ $( "#toggle" ).on( "click", function() {
$( "#combobox" ).toggle();
});
});
$( "#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();
$( "#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();
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 ) } );
}),
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 } );
}
}),
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" );
return false;
}
});
- element.val( "ja" ).keydown();
+ element.val( "ja" ).trigger( "keydown" );
setTimeout(function() {
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
equal( element.val(), customVal );
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 } );
ok( false, "opened after a blur" );
}
});
- ac.val( "ro" ).keydown();
+ ac.val( "ro" ).trigger( "keydown" );
});
} );
start();
}
});
- element.val( "ja" ).keydown();
+ element.val( "ja" ).trigger( "keydown" );
stop();
}
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" );
delay: 0
}),
menu = element.autocomplete( "disable" ).autocomplete( "widget" );
- element.val( "ja" ).keydown();
+ element.val( "ja" ).trigger( "keydown" );
ok( menu.is( ":hidden" ) );
// 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" );
}
} );
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 );
// 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