.addClass( 'suggestions-result' )
.attr( 'rel', i )
.data( 'text', context.config.suggestions[ i ] )
- .mousemove( function () {
+ .on( 'mousemove', function () {
context.data.selectedWithMouse = true;
$.suggestions.highlight(
context,
context.data.$textbox.val( result.data( 'text' ) );
// .val() doesn't call any event handlers, so
// let the world know what happened
- context.data.$textbox.change();
+ context.data.$textbox.trigger( 'change' );
}
context.data.$textbox.trigger( 'change' );
}
// Can't use click() because the container div is hidden when the
// textbox loses focus. Instead, listen for a mousedown followed
// by a mouseup on the same div.
- .mousedown( function ( e ) {
+ .on( 'mousedown', function ( e ) {
context.data.mouseDownOn = $( e.target ).closest( '.suggestions-results .suggestions-result' );
} )
- .mouseup( function ( e ) {
+ .on( 'mouseup', function ( e ) {
var $result = $( e.target ).closest( '.suggestions-results .suggestions-result' ),
$other = context.data.mouseDownOn;
// when done synchronously in at least Firefox 3.6 (T64858).
setTimeout( function () {
$.suggestions.hide( context );
- }, 0 );
+ } );
}
// Always bring focus to the textbox, as that's probably where the user expects it
// if they were just typing.
- context.data.$textbox.focus();
+ context.data.$textbox.trigger( 'focus' );
} )
)
.append(
// Can't use click() because the container div is hidden when the
// textbox loses focus. Instead, listen for a mousedown followed
// by a mouseup on the same div.
- .mousedown( function ( e ) {
+ .on( 'mousedown', function ( e ) {
context.data.mouseDownOn = $( e.target ).closest( '.suggestions-special' );
} )
- .mouseup( function ( e ) {
+ .on( 'mouseup', function ( e ) {
var $special = $( e.target ).closest( '.suggestions-special' ),
$other = context.data.mouseDownOn;
// when done synchronously in at least Firefox 3.6 (T64858).
setTimeout( function () {
$.suggestions.hide( context );
- }, 0 );
+ } );
}
// Always bring focus to the textbox, as that's probably where the user expects it
// if they were just typing.
- context.data.$textbox.focus();
+ context.data.$textbox.trigger( 'focus' );
} )
- .mousemove( function ( e ) {
+ .on( 'mousemove', function ( e ) {
context.data.selectedWithMouse = true;
$.suggestions.highlight(
context, $( e.target ).closest( '.suggestions-special' ), false
$( this )
// Stop browser autocomplete from interfering
.attr( 'autocomplete', 'off' )
- .keydown( function ( e ) {
+ .on( 'keydown', function ( e ) {
// Store key pressed to handle later
context.data.keypressed = e.which;
context.data.keypressedCount = 0;
} )
- .keypress( function ( e ) {
+ .on( 'keypress', function ( e ) {
context.data.keypressedCount++;
$.suggestions.keypress( e, context, context.data.keypressed );
} )
- .keyup( function ( e ) {
+ .on( 'keyup', function ( e ) {
// The keypress event is fired when a key is pressed down and that key normally
// produces a character value. We also want to handle some keys that don't
// produce a character value so we also attach to the keydown/keyup events.
$.suggestions.keypress( e, context, context.data.keypressed );
}
} )
- .blur( function () {
+ .on( 'blur', function () {
// When losing focus because of a mousedown
// on a suggestion, don't hide the suggestions
if ( context.data.mouseDownOn.length > 0 ) {