Skip to content

Commit d8ea1af

Browse files
committed
Consolidate die <entry>s and fix xml bug.
Fixes jquery#109
1 parent b01f17f commit d8ea1af

File tree

1 file changed

+61
-69
lines changed

1 file changed

+61
-69
lines changed

entries/die.xml

+61-69
Original file line numberDiff line numberDiff line change
@@ -1,91 +1,83 @@
11
<?xml version="1.0"?>
2-
<entries>
3-
<entry type="method" name="die" return="jQuery" deprecated="1.7">
4-
<title>.die()</title>
5-
<desc><![CDATA[Remove all event handlers previously attached using <code>.live()</code> from the elements.]]></desc>
6-
<signature>
7-
<added>1.4.1</added>
8-
</signature>
9-
<longdesc>
10-
<p>Any handler that has been attached with <code>.live()</code> can be removed with <code>.die()</code>. This method is analogous to calling <code>.unbind()</code> with no arguments, which is used to remove all handlers attached with <code>.bind()</code>.
11-
See the discussions of <code>.live()</code> and <code>.unbind()</code> for further details.</p>
12-
<p><strong>As of jQuery 1.7</strong>, use of <code>.die()</code> (and its complementary method, <code>.live()</code>) is not recommended. Instead, use <a href="http://api.jquery.com/off/"><code>.off()</code></a> to remove event handlers bound with <a href="http://api.jquery.com/on/"><code>.on()</code></a></p>
13-
<p><strong>Note:</strong> In order for .die() to function correctly, the selector used with it must match exactly the selector initially used with .live().</p>
14-
<category slug="events/event-handler-attachment"/>
15-
<category slug="version/1.3"/>
16-
<category slug="version/1.4.1"/>
17-
<category slug="version/1.4.3"/>
18-
</entry>
19-
<entry type="method" name="die" return="jQuery" deprecated="1.7">
20-
<desc><![CDATA[Remove an event handler previously attached using <code>.live()</code> from the elements.]]></desc>
21-
<signature>
22-
<added>1.3</added>
23-
<argument name="eventType" type="String">
24-
<desc>A string containing a JavaScript event type, such as <code>click</code> or <code>keydown</code>.</desc>
25-
</argument>
26-
<argument name="handler" optional="true" type="String">
27-
<desc>The function that is no longer to be executed.</desc>
28-
</argument>
29-
</signature>
30-
<signature>
31-
<added>1.4.3</added>
32-
<argument name="events" type="PlainObject">
33-
<desc>A map of one or more event types, such as <code>click</code> or <code>keydown</code> and their corresponding functions that are no longer to be executed.</desc>
34-
</argument>
35-
</signature>
36-
<longdesc>
37-
<p>Any handler that has been attached with <code>.live()</code> can be removed with <code>.die()</code>. This method is analogous to <code>.unbind()</code>, which is used to remove handlers attached with <code>.bind()</code>.
38-
See the discussions of <code>.live()</code> and <code>.unbind()</code> for further details.</p>
39-
<p><strong>Note:</strong> In order for <code>.die()</code> to function correctly, the selector used with it must match exactly the selector initially used with <code>.live()</code>.</p>
40-
</longdesc>
41-
<example>
42-
<desc>Can bind and unbind events to the colored button.</desc>
43-
<code><![CDATA[
44-
2+
<entry type="method" name="die" return="jQuery" deprecated="1.7">
3+
<title>.die()</title>
4+
<desc><![CDATA[Remove event handlers previously attached using <code>.live()</code> from the elements.]]></desc>
5+
<signature>
6+
<added>1.4.1</added>
7+
</signature>
8+
<signature>
9+
<added>1.3</added>
10+
<argument name="eventType" type="String">
11+
<desc>A string containing a JavaScript event type, such as <code>click</code> or <code>keydown</code>.</desc>
12+
</argument>
13+
<argument name="handler" optional="true" type="String">
14+
<desc>The function that is no longer to be executed.</desc>
15+
</argument>
16+
</signature>
17+
<signature>
18+
<added>1.4.3</added>
19+
<argument name="events" type="PlainObject">
20+
<desc>A map of one or more event types, such as <code>click</code> or <code>keydown</code> and their corresponding functions that are no longer to be executed.</desc>
21+
</argument>
22+
</signature>
23+
<longdesc>
24+
<p>Any handler that has been attached with <code>.live()</code> can be removed with <code>.die()</code>. This method is analogous to calling <code>.unbind()</code> with no arguments, which is used to remove all handlers attached with <code>.bind()</code>.
25+
See the discussions of <code>.live()</code> and <code>.unbind()</code> for further details.</p>
26+
<p>If used without an argument, .die() removes <em>all</em> event handlers previously attached using <code>.live()</code> from the elements.</p>
27+
<p><strong>As of jQuery 1.7</strong>, use of <code>.die()</code> (and its complementary method, <code>.live()</code>) is not recommended. Instead, use <a href="http://api.jquery.com/off/"><code>.off()</code></a> to remove event handlers bound with <a href="http://api.jquery.com/on/"><code>.on()</code></a></p>
28+
<p><strong>Note:</strong> In order for .die() to function correctly, the selector used with it must match exactly the selector initially used with .live().</p>
29+
</longdesc>
30+
<category slug="events/event-handler-attachment"/>
31+
<category slug="version/1.3"/>
32+
<category slug="version/1.4.1"/>
33+
<category slug="version/1.4.3"/>
34+
<example>
35+
<desc>Can bind and unbind events to the colored button.</desc>
36+
<code><![CDATA[
4537
function aClick() {
4638
$("div").show().fadeOut("slow");
4739
}
4840
$("#bind").click(function () {
49-
$("#theone").live("click", aClick)
50-
.text("Can Click!");
41+
$("#theone").live("click", aClick)
42+
.text("Can Click!");
5143
});
5244
$("#unbind").click(function () {
53-
$("#theone").die("click", aClick)
54-
.text("Does nothing...");
45+
$("#theone").die("click", aClick)
46+
.text("Does nothing...");
5547
});
5648
5749
]]></code>
58-
<css><![CDATA[
50+
<css><![CDATA[
5951
button { margin:5px; }
6052
button#theone { color:red; background:yellow; }
6153
]]></css>
62-
<html><![CDATA[<button id="theone">Does nothing...</button>
54+
<html><![CDATA[<button id="theone">Does nothing...</button>
6355
<button id="bind">Bind Click</button>
6456
<button id="unbind">Unbind Click</button>
6557
6658
<div style="display:none;">Click!</div>]]></html>
67-
</example>
68-
<example>
69-
<desc>To unbind all live events from all paragraphs, write:</desc>
70-
<code><![CDATA[$("p").die()]]></code>
71-
</example>
72-
<example>
73-
<desc>To unbind all live click events from all paragraphs, write:</desc>
74-
<code><![CDATA[$("p").die( "click" )]]></code>
75-
</example>
76-
<example>
77-
<desc>To unbind just one previously bound handler, pass the function in as the second argument:</desc>
78-
<code><![CDATA[var foo = function () {
79-
// code to handle some kind of event
59+
</example>
60+
<example>
61+
<desc>To unbind all live events from all paragraphs, write:</desc>
62+
<code><![CDATA[$("p").die()]]></code>
63+
</example>
64+
<example>
65+
<desc>To unbind all live click events from all paragraphs, write:</desc>
66+
<code><![CDATA[$("p").die( "click" )]]></code>
67+
</example>
68+
<example>
69+
<desc>To unbind just one previously bound handler, pass the function in as the second argument:</desc>
70+
<code><![CDATA[var foo = function () {
71+
// code to handle some kind of event
8072
};
8173
8274
$("p").live("click", foo); // ... now foo will be called when paragraphs are clicked ...
8375
8476
$("p").die("click", foo); // ... foo will no longer be called.]]></code>
85-
</example>
86-
<category slug="events/event-handler-attachment"/>
87-
<category slug="version/1.3"/>
88-
<category slug="version/1.4.1"/>
89-
<category slug="version/1.4.3"/>
90-
</entry>
91-
</entries>
77+
</example>
78+
<category slug="events/event-handler-attachment"/>
79+
<category slug="version/1.3"/>
80+
<category slug="version/1.4.1"/>
81+
<category slug="version/1.4.3"/>
82+
</entry>
83+

0 commit comments

Comments
 (0)