Skip to content

Commit 9fa469e

Browse files
AurelioDeRosamgol
authored andcommitted
bind, unbind, delegate, undelegate: Document the methods were deprecated in jQuery 3
Also, add the missing deprecated-3.0 category Fixes gh-945
1 parent ae219e2 commit 9fa469e

File tree

5 files changed

+19
-8
lines changed

5 files changed

+19
-8
lines changed

categories.xml

+5
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@
6666
<p>For more information, see the Release Notes/Changelog at <a href="https://blog.jquery.com/2013/05/24/jquery-1-10-0-and-2-0-1-released/">https://blog.jquery.com/2013/05/24/jquery-1-10-0-and-2-0-1-released/</a></p>
6767
]]></desc>
6868
</category>
69+
<category name="Deprecated 3.0" slug="deprecated-3.0">
70+
<desc><![CDATA[All the aspects of the API that were deprecated in the corresponding version of jQuery.
71+
<p>For more information, see the Release Notes/Changelog at <a href="http://blog.jquery.com/2016/06/09/jquery-3-0-final-released/">http://blog.jquery.com/2016/06/09/jquery-3-0-final-released/</a></p>
72+
]]></desc>
73+
</category>
6974
</category>
7075
<category name="Dimensions" slug="dimensions">
7176
<desc><![CDATA[These methods are used to get and set the CSS dimensions for the various properties.]]></desc>

entries/bind.xml

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0"?>
2-
<entry type="method" name="bind" return="jQuery">
2+
<entry type="method" name="bind" return="jQuery" deprecated="3.0">
33
<title>.bind()</title>
44
<signature>
55
<added>1.0</added>
@@ -34,7 +34,7 @@
3434
</signature>
3535
<desc>Attach a handler to an event for the elements.</desc>
3636
<longdesc>
37-
<p>As of jQuery 1.7, the <a href="/on/"><code>.on()</code></a> method is the preferred method for attaching event handlers to a document. For earlier versions, the <code>.bind()</code> method is used for attaching an event handler directly to elements. Handlers are attached to the currently selected elements in the jQuery object, so those elements <em>must exist</em> at the point the call to <code>.bind()</code> occurs. For more flexible event binding, see the discussion of event delegation in <a href="/on/"><code>.on()</code></a> or <a href="/delegate/"><code>.delegate()</code></a>.</p>
37+
<p>As of jQuery 3.0, <code>.bind()</code> has been deprecated. It was superseded by the <a href="/on/"><code>.on()</code></a> method for attaching event handlers to a document since jQuery 1.7, so its use was already discouraged. For earlier versions, the <code>.bind()</code> method is used for attaching an event handler directly to elements. Handlers are attached to the currently selected elements in the jQuery object, so those elements <em>must exist</em> at the point the call to <code>.bind()</code> occurs. For more flexible event binding, see the discussion of event delegation in <a href="/on/"><code>.on()</code></a> or <a href="/delegate/"><code>.delegate()</code></a>.</p>
3838
<p>Any string is legal for <code>eventType</code>; if the string is not the name of a native DOM event, then the handler is bound to a custom event. These events are never called by the browser, but may be triggered manually from other JavaScript code using <code>.trigger()</code> or <code>.triggerHandler()</code>.</p>
3939
<p>If the <code>eventType</code> string contains a period (<code>.</code>) character, then the event is namespaced. The period character separates the event from its namespace. For example, in the call <code>.bind( "click.name", handler )</code>, the string <code>click</code> is the event type, and the string <code>name</code> is the namespace. Namespacing allows us to unbind or trigger some events of a type without affecting others. See the discussion of <code>.unbind()</code> for more information.</p>
4040
<p>There are shorthand methods for some standard browser events such as <a href="/click/"><code>.click()</code></a> that can be used to attach or trigger event handlers. For a complete list of shorthand methods, see the <a href="/category/events/">events category</a>.</p>
@@ -259,4 +259,5 @@ $( "div.test" ).bind({
259259
<category slug="version/1.0"/>
260260
<category slug="version/1.4"/>
261261
<category slug="version/1.4.3"/>
262+
<category slug="deprecated/deprecated-3.0"/>
262263
</entry>

entries/delegate.xml

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0"?>
2-
<entry type="method" name="delegate" return="jQuery">
2+
<entry type="method" name="delegate" return="jQuery" deprecated="3.0">
33
<title>.delegate()</title>
44
<desc>Attach a handler to one or more events for all elements that match the selector, now or in the future, based on a specific set of root elements.</desc>
55
<signature>
@@ -41,7 +41,7 @@
4141
</argument>
4242
</signature>
4343
<longdesc>
44-
<p>As of jQuery 1.7, <code>.delegate()</code> has been superseded by the <a href="/on/">.on()</a> method. For earlier versions, however, it remains the most effective means to use event delegation. More information on event binding and delegation is in the <a href="/on/">.on()</a> method. In general, these are the equivalent templates for the two methods:</p>
44+
<p>As of jQuery 3.0, <code>.delegate()</code> has been deprecated. It was superseded by the <a href="/on/"><code>.on()</code></a> method since jQuery 1.7, so its use was already discouraged. For earlier versions, however, it remains the most effective means to use event delegation. More information on event binding and delegation is in the <a href="/on/"><code>.on()</code></a> method. In general, these are the equivalent templates for the two methods:</p>
4545
<pre><code>
4646
// jQuery 1.4.3+
4747
$( elements ).delegate( selector, events, data, handler );
@@ -148,4 +148,5 @@ $( "button" ).click(function() {
148148
<category slug="events/event-handler-attachment"/>
149149
<category slug="version/1.4.2"/>
150150
<category slug="version/1.4.3"/>
151+
<category slug="deprecated/deprecated-3.0"/>
151152
</entry>

entries/unbind.xml

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0"?>
2-
<entry type="method" name="unbind" return="jQuery">
2+
<entry type="method" name="unbind" return="jQuery" deprecated="3.0">
33
<title>.unbind()</title>
44
<desc>Remove a previously-attached event handler from the elements.</desc>
55
<signature>
@@ -31,7 +31,8 @@
3131
<added>1.0</added>
3232
</signature>
3333
<longdesc>
34-
<p>Event handlers attached with <code>.bind()</code> can be removed with <code>.unbind()</code>. (As of jQuery 1.7, the <a href="/on/"><code>.on()</code></a> and <a href="/off/"><code>.off()</code></a> methods are preferred to attach and remove event handlers on elements.) In the simplest case, with no arguments, <code>.unbind()</code> removes all handlers attached to the elements:</p>
34+
<p>As of jQuery 3.0, <code>.unbind()</code> has been deprecated. It was superseded by the <a href="/off/"><code>.off()</code></a> method since jQuery 1.7, so its use was already discouraged.</p>
35+
<p>Event handlers attached with <code>.bind()</code> can be removed with <code>.unbind()</code>. In the simplest case, with no arguments, <code>.unbind()</code> removes all handlers attached to the elements:</p>
3536
<pre><code>
3637
$( "#foo" ).unbind();
3738
</code></pre>
@@ -155,4 +156,5 @@ $( "p" ).unbind( "click", foo ); // ... foo will no longer be called.
155156
<category slug="events/event-handler-attachment"/>
156157
<category slug="version/1.0"/>
157158
<category slug="version/1.4.3"/>
159+
<category slug="deprecated/deprecated-3.0"/>
158160
</entry>

entries/undelegate.xml

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0"?>
2-
<entry type="method" name="undelegate" return="jQuery">
2+
<entry type="method" name="undelegate" return="jQuery" deprecated="3.0">
33
<title>.undelegate()</title>
44
<desc>Remove a handler from the event for all elements which match the current selector, based upon a specific set of root elements.</desc>
55
<signature>
@@ -43,7 +43,8 @@
4343
</argument>
4444
</signature>
4545
<longdesc>
46-
<p>The <code>.undelegate()</code> method is a way of removing event handlers that have been bound using <a href="/delegate/"><code>.delegate()</code></a>. <strong>As of jQuery 1.7</strong>, the <a href="/on/"><code>.on()</code></a> and <a href="/off/"><code>.off()</code></a> methods are preferred for attaching and removing event handlers.</p>
46+
<p>As of jQuery 3.0, <code>.undelegate()</code> has been deprecated. It was superseded by the <a href="/off/"><code>.off()</code></a> method since jQuery 1.7, so its use was already discouraged.</p>
47+
<p>The <code>.undelegate()</code> method is a way of removing event handlers that have been bound using <a href="/delegate/"><code>.delegate()</code></a>.</p>
4748
</longdesc>
4849
<example>
4950
<desc>Can bind and unbind events to the colored button.</desc>
@@ -124,4 +125,5 @@ $( "form" ).undelegate( ".whatever" );
124125
<category slug="version/1.4.2"/>
125126
<category slug="version/1.4.3"/>
126127
<category slug="version/1.6"/>
128+
<category slug="deprecated/deprecated-3.0"/>
127129
</entry>

0 commit comments

Comments
 (0)