From f4ef03e57edd7e51cb134e902679c7bddc3daaee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Go=C5=82=C4=99biowski-Owczarek?= Date: Sat, 16 May 2020 08:36:55 +0200 Subject: [PATCH] All: Resolve most jQuery Migrate warnings Closes gh-1919 --- demos/tabs/sortable.html | 2 +- tests/unit/button/core.js | 2 +- tests/unit/checkboxradio/core.js | 4 ++-- tests/unit/checkboxradio/events.js | 2 +- tests/unit/menu/core.js | 2 +- ui/effects/effect-size.js | 2 ++ ui/safe-offset.js | 0 ui/widgets/button.js | 2 +- ui/widgets/selectmenu.js | 2 +- ui/widgets/tooltip.js | 2 +- 10 files changed, 11 insertions(+), 9 deletions(-) create mode 100644 ui/safe-offset.js diff --git a/demos/tabs/sortable.html b/demos/tabs/sortable.html index 9888cff77..81ae22a25 100644 --- a/demos/tabs/sortable.html +++ b/demos/tabs/sortable.html @@ -22,7 +22,7 @@ stop: function(event, ui) { tabs.tabs( "refresh" ); if (previouslyFocused) { - ui.item.focus(); + ui.item.trigger( "focus" ); } } }); diff --git a/tests/unit/button/core.js b/tests/unit/button/core.js index 13bc94e33..98219c66c 100644 --- a/tests/unit/button/core.js +++ b/tests/unit/button/core.js @@ -12,7 +12,7 @@ QUnit.test( "Disabled button loses focus", function( assert ) { assert.expect( 2 ); var element = $( "#button" ).button(); - element.focus(); + element.trigger( "focus" ); setTimeout( function() { assert.equal( element[ 0 ], $.ui.safeActiveElement( document ), "Button is focused" ); diff --git a/tests/unit/checkboxradio/core.js b/tests/unit/checkboxradio/core.js index fe2774d02..39d8c6831 100644 --- a/tests/unit/checkboxradio/core.js +++ b/tests/unit/checkboxradio/core.js @@ -34,7 +34,7 @@ QUnit.test( "Ensure checked after single click on checkbox label button", functi var ready = assert.async(); assert.expect( 2 ); - $( "#check2" ).checkboxradio().change( function() { + $( "#check2" ).checkboxradio().on( "change", function() { var label = $( this ).checkboxradio( "widget" ); assert.ok( this.checked, "checked ok" ); @@ -59,7 +59,7 @@ QUnit.test( "Handle form association via form attribute", function( assert ) { var radio2 = $( "#crazy-form-2" ).checkboxradio(); var radio2Label = radio2.checkboxradio( "widget" ); - radio2.change( function() { + radio2.on( "change", function() { assert.ok( this.checked, "#2 checked" ); assert.ok( !radio1[ 0 ].checked, "#1 not checked" ); diff --git a/tests/unit/checkboxradio/events.js b/tests/unit/checkboxradio/events.js index 9e391897f..96580c791 100644 --- a/tests/unit/checkboxradio/events.js +++ b/tests/unit/checkboxradio/events.js @@ -35,7 +35,7 @@ QUnit.test( "Checkbox shows focus when using keyboard navigation", function( ass var check = $( "#check" ).checkboxradio(), label = $( "label[for='check']" ); assert.lacksClasses( label, "ui-state-focus" ); - check.focus(); + check.trigger( "focus" ); setTimeout( function() { assert.hasClasses( label, "ui-state-focus" ); ready(); diff --git a/tests/unit/menu/core.js b/tests/unit/menu/core.js index be68eddca..8380d66bd 100644 --- a/tests/unit/menu/core.js +++ b/tests/unit/menu/core.js @@ -96,7 +96,7 @@ QUnit.test( "active menu item styling", function( assert ) { setTimeout( function() { isActive( parentItem ); isActive( childItem ); - element.blur(); + element.trigger( "blur" ); setTimeout( function() { isInactive( parentItem ); isInactive( childItem ); diff --git a/ui/effects/effect-size.js b/ui/effects/effect-size.js index 20af22777..95a1423e6 100644 --- a/ui/effects/effect-size.js +++ b/ui/effects/effect-size.js @@ -105,6 +105,8 @@ return $.effects.define( "size", function( options, done ) { to.top = ( original.outerHeight - to.outerHeight ) * baseline.y + pos.top; to.left = ( original.outerWidth - to.outerWidth ) * baseline.x + pos.left; } + delete from.outerHeight; + delete from.outerWidth; element.css( from ); // Animate the children if desired diff --git a/ui/safe-offset.js b/ui/safe-offset.js new file mode 100644 index 000000000..e69de29bb diff --git a/ui/widgets/button.js b/ui/widgets/button.js index 3def0f9aa..a4be3c76e 100644 --- a/ui/widgets/button.js +++ b/ui/widgets/button.js @@ -263,7 +263,7 @@ $.widget( "ui.button", { this._toggleClass( null, "ui-state-disabled", value ); this.element[ 0 ].disabled = value; if ( value ) { - this.element.blur(); + this.element.trigger( "blur" ); } } }, diff --git a/ui/widgets/selectmenu.js b/ui/widgets/selectmenu.js index 52139f73e..79e97816b 100644 --- a/ui/widgets/selectmenu.js +++ b/ui/widgets/selectmenu.js @@ -97,7 +97,7 @@ return $.widget( "ui.selectmenu", [ $.ui.formResetMixin, { this.labels = this.element.labels().attr( "for", this.ids.button ); this._on( this.labels, { click: function( event ) { - this.button.focus(); + this.button.trigger( "focus" ); event.preventDefault(); } } ); diff --git a/ui/widgets/tooltip.js b/ui/widgets/tooltip.js index d466410d7..106485269 100644 --- a/ui/widgets/tooltip.js +++ b/ui/widgets/tooltip.js @@ -331,7 +331,7 @@ $.widget( "ui.tooltip", { position( positionOption.of ); clearInterval( delayedShow ); } - }, $.fx.interval ); + }, 13 ); } this._trigger( "open", event, { tooltip: tooltip } );