Skip to content

Commit bbc91e3

Browse files
committed
hover: Deprecate the API
1 parent 44ed5e6 commit bbc91e3

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

entries/hover.xml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0"?>
22
<entries>
33
<desc>Bind one or two handlers to the matched elements, to be executed when the mouse pointer enters and leaves the elements.</desc>
4-
<entry type="method" name="hover" return="jQuery">
4+
<entry type="method" name="hover" return="jQuery" deprecated="3.3">
55
<title>.hover()</title>
66
<desc>Bind two handlers to the matched elements, to be executed when the mouse pointer enters and leaves the elements.</desc>
77
<signature>
@@ -16,12 +16,15 @@
1616
</argument>
1717
</signature>
1818
<longdesc>
19+
<div class="warning">
20+
<p>This API is deprecated. Use <code>.on( "mouseenter", handlerIn ).on( "mouseleave", handlerOut )</code> instead.</p>
21+
</div>
1922
<p>The <code>.hover()</code> method binds handlers for both <code>mouseenter</code> and <code>mouseleave</code> events. You can use it to simply apply behavior to an element during the time the mouse is within the element.</p>
2023
<p>Calling <code>$( selector ).hover( handlerIn, handlerOut )</code> is shorthand for:</p>
2124
<pre><code>
22-
$( selector ).mouseenter( handlerIn ).mouseleave( handlerOut );
25+
$( selector ).on( "mouseenter", handlerIn ).on( "mouseleave", handlerOut );
2326
</code></pre>
24-
<p>See the discussions for <code><a href="/mouseenter/">.mouseenter()</a></code> and <code><a href="/mouseleave/">.mouseleave()</a></code> for more details.</p>
27+
<p>See the discussions for <code><a href="/mouseenter/">mouseenter</a></code> and <code><a href="/mouseleave/">mouseleave</a></code> for more details.</p>
2528
</longdesc>
2629
<example>
2730
<desc>To add a special style to list items that are being hovered over, try:</desc>
@@ -80,8 +83,10 @@ $( "td" ).off( "mouseenter mouseleave" );
8083
</example>
8184
<category slug="events/mouse-events"/>
8285
<category slug="version/1.0"/>
86+
<category slug="deprecated/deprecated-3.3"/>
8387
</entry>
84-
<entry type="method" name="hover" return="jQuery">
88+
89+
<entry type="method" name="hover" return="jQuery" deprecated="3.3">
8590
<desc>Bind a single handler to the matched elements, to be executed when the mouse pointer enters or leaves the elements.</desc>
8691
<signature>
8792
<added>1.4</added>
@@ -91,12 +96,15 @@ $( "td" ).off( "mouseenter mouseleave" );
9196
</argument>
9297
</signature>
9398
<longdesc>
99+
<div class="warning">
100+
<p>This API is deprecated. Use <code>.on( "mouseenter mouseleave", handlerInOut )</code> instead.</p>
101+
</div>
94102
<p>The <code>.hover()</code> method, when passed a single function, will execute that handler for both <code>mouseenter</code> and <code>mouseleave</code> events. This allows the user to use jQuery's various toggle methods within the handler or to respond differently within the handler depending on the <code>event.type</code>.</p>
95103
<p>Calling <code>$(selector).hover(handlerInOut)</code> is shorthand for:</p>
96104
<pre><code>
97105
$( selector ).on( "mouseenter mouseleave", handlerInOut );
98106
</code></pre>
99-
<p>See the discussions for <code><a href="/mouseenter/">.mouseenter()</a></code> and <code><a href="/mouseleave/">.mouseleave()</a></code> for more details.</p>
107+
<p>See the discussions for <code><a href="/mouseenter/">mouseenter</a></code> and <code><a href="/mouseleave/">mouseleave</a></code> for more details.</p>
100108
</longdesc>
101109
<example>
102110
<desc>Slide the next sibling LI up or down on hover, and toggle a class.</desc>
@@ -143,5 +151,6 @@ $( "li" )
143151
</example>
144152
<category slug="events/mouse-events"/>
145153
<category slug="version/1.0"/>
154+
<category slug="deprecated/deprecated-3.3"/>
146155
</entry>
147156
</entries>

0 commit comments

Comments
 (0)