]> source.dussan.org Git - jquery.git/commitdiff
Deprecated: Define `.hover()` using non-deprecated methods
authorMichał Gołębiowski-Owczarek <m.goleb@gmail.com>
Mon, 22 May 2023 16:23:19 +0000 (18:23 +0200)
committerGitHub <noreply@github.com>
Mon, 22 May 2023 16:23:19 +0000 (18:23 +0200)
Make the deprecated `.hover()` method not rely on other deprecated
methods: `.mouseenter()` & `.mouseleave()`. Use `.on()` instead.

Closes gh-5251

src/deprecated/event.js

index 84ff5bad00c52af517570f039bbd728f8d3b292c..4f5c59c0a54d2e453d961a57a22fc6cb831e11a7 100644 (file)
@@ -24,7 +24,9 @@ jQuery.fn.extend( {
        },
 
        hover: function( fnOver, fnOut ) {
-               return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
+               return this
+                       .on( "mouseenter", fnOver )
+                       .on( "mouseleave", fnOut || fnOver );
        }
 } );