]> source.dussan.org Git - jquery-ui.git/commitdiff
Autocomplete: Remove core event/alias and deprecated module dependencies
authorAlexander Schmitz <arschmitz@gmail.com>
Thu, 14 May 2015 01:54:08 +0000 (21:54 -0400)
committerAlexander Schmitz <arschmitz@gmail.com>
Wed, 20 May 2015 18:27:55 +0000 (14:27 -0400)
demos/autocomplete/combobox.html
demos/autocomplete/multiple-remote.html
demos/autocomplete/multiple.html
tests/unit/autocomplete/core.js
tests/unit/autocomplete/events.js
tests/unit/autocomplete/options.js
ui/autocomplete.js

index f8898094dc8e9c48dfcfa4b572c213213238fd98..76d7924707a83ff3cfd7f2174dc563550a72ebc2 100644 (file)
                                        })
                                        .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();
                });
        });
index 72c001754ff22c7834f67838f12f6d6a10d15ae3..45f3198653d01cb7aa0033003fe40b84f7b51a3f 100644 (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();
index 63d379067367f54dcd4c825ca20e85ce0f66ae64..1bd70f2289634df0bd7442fcc94e1f70884603c5 100644 (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();
index d25328dd54452e57b677de13848f4fc62dfad636..184bcdbf423df504e0d004c3edf1c0aaaf625e35 100644 (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 ) } );
index 606562aa99a3ba499ef2813eb01a21f61b5b8cd3..8f96fb77f1ddba089088d156b31633f64dfecc7c 100644 (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" );
 });
 
 } );
index a07a8d63667e14028d82920af9fb6e8c41e856b4..06c75722b32d905d6d543cfc5f0382ff58dc8fd6 100644 (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" ) );
 
index a3db1a9f84a685799a8a5b996a290f2b24dffe0c..8c8ce2b68fa8b9e15d20bd1506a559b70ad64ae3 100644 (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