Skip to content

Commit b905a92

Browse files
authored
All: Upgrade jQuery used in examples from 1.10.2 to 3.4.1
The upgrade is necessary to be able to write examples for newer APIs. Examples for removed APIs have been removed as they'd no longer work. Fixes jquerygh-982 Closes jquerygh-1148
1 parent df5b4b6 commit b905a92

15 files changed

+50
-103
lines changed

entries/andSelf.xml

+3-65
Original file line numberDiff line numberDiff line change
@@ -6,72 +6,10 @@
66
</signature>
77
<desc>Add the previous set of elements on the stack to the current set.</desc>
88
<longdesc>
9-
<p><strong>Note:</strong> This function has been deprecated and is now an alias for <a href="/addBack/"><code>.addBack()</code></a>, which should be used with jQuery 1.8 and later.</p>
10-
<p>As described in the discussion for <code><a href="/end/">.end()</a></code>, jQuery objects maintain an internal stack that keeps track of changes to the matched set of elements. When one of the DOM traversal methods is called, the new set of elements is pushed onto the stack. If the previous set of elements is desired as well, <code>.andSelf()</code> can help.</p>
11-
<p>Consider a page with a simple list on it:</p>
12-
<pre><code>
13-
&lt;ul&gt;
14-
&lt;li&gt;list item 1&lt;/li&gt;
15-
&lt;li&gt;list item 2&lt;/li&gt;
16-
&lt;li class="third-item"&gt;list item 3&lt;/li&gt;
17-
&lt;li&gt;list item 4&lt;/li&gt;
18-
&lt;li&gt;list item 5&lt;/li&gt;
19-
&lt;/ul&gt;
20-
</code></pre>
21-
<p>The result of the following code is a red background behind items 3, 4 and 5:</p>
22-
<pre><code>
23-
$( "li.third-item" ).nextAll().andSelf()
24-
.css( "background-color", "red" );
25-
</code></pre>
26-
<p>First, the initial selector locates item 3, initializing the stack with the set containing just this item. The call to <code>.nextAll()</code> then pushes the set of items 4 and 5 onto the stack. Finally, the <code>.andSelf()</code> invocation merges these two sets together, creating a jQuery object that points to all three items in document order: <code>[ &lt;li.third-item&gt;, &lt;li&gt;, &lt;li&gt; ]</code>.</p>
9+
<div class="warning">
10+
<p>Note: This API has been removed in jQuery 3.0; use <a href="/addBack/"><code>.addBack()</code></a> instead, which should work identically.</p>
11+
</div>
2712
</longdesc>
28-
<example>
29-
<desc>The <code>.andSelf()</code> method causes the previous set of DOM elements in the traversal stack to be added to the current set. In the first example, the top stack contains the set resulting from <code>.find("p")</code>. In the second example, <code>.andSelf()</code> adds the previous set of elements on the stack — in this case <code>$( "div.after-andself" )</code> — to the current set, selecting both the div and its enclosed paragraphs.</desc>
30-
<code><![CDATA[
31-
$( "div.left, div.right" ).find( "div, div > p" ).addClass( "border" );
32-
33-
// First Example
34-
$( "div.before-andself" ).find( "p" ).addClass( "background" );
35-
36-
// Second Example
37-
$( "div.after-andself" ).find( "p" ).andSelf().addClass( "background" );
38-
]]></code>
39-
<css><![CDATA[
40-
p, div {
41-
margin: 5px;
42-
padding: 5px;
43-
}
44-
.border {
45-
border: 2px solid red;
46-
}
47-
.background {
48-
background: yellow;
49-
}
50-
.left, .right {
51-
width: 45%;
52-
float: left;
53-
}
54-
.right {
55-
margin-left: 3%;
56-
}
57-
]]></css>
58-
<html><![CDATA[
59-
<div class="left">
60-
<p><strong>Before <code>andSelf()</code></strong></p>
61-
<div class="before-andself">
62-
<p>First Paragraph</p>
63-
<p>Second Paragraph</p>
64-
</div>
65-
</div>
66-
<div class="right">
67-
<p><strong>After <code>andSelf()</code></strong></p>
68-
<div class="after-andself">
69-
<p>First Paragraph</p>
70-
<p>Second Paragraph</p>
71-
</div>
72-
</div>
73-
]]></html>
74-
</example>
7513
<category slug="traversing/miscellaneous-traversal"/>
7614
<category slug="version/1.2"/>
7715
<category slug="deprecated/deprecated-1.8"/>

entries/context.xml

+3-4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
</signature>
77
<desc>The DOM node context originally passed to <code>jQuery()</code>; if none was passed then context will likely be the document.</desc>
88
<longdesc>
9-
<p>The <code>.context</code> property was deprecated in jQuery 1.10 and is only maintained to the extent needed for supporting <code>.live()</code> in the jQuery Migrate plugin. It may be removed without notice in a future version.</p>
9+
<div class="warning">
10+
<p>Note: This API has been removed in jQuery 3.0.</p>
11+
</div>
1012
<p>The <code>.live()</code> method for binding event handlers uses this property to determine the root element to use for its event delegation needs.</p>
1113
<p>The value of this property is typically equal to <code>document</code>, as this is the default context for jQuery objects if none is supplied. The context may differ if, for example, the object was created by searching within an <code>&lt;iframe&gt;</code> or XML document.</p>
1214
<p>Note that the context property may only apply to the elements originally selected by <code>jQuery()</code>, as it is possible for the user to add elements to the collection via methods such as <code>.add()</code> and these may have a different context.</p>
@@ -18,9 +20,6 @@ $( "ul" )
1820
.append( "<li>" + $( "ul" ).context + "</li>" )
1921
.append( "<li>" + $( "ul", document.body ).context.nodeName + "</li>" );
2022
]]></code>
21-
<html><![CDATA[
22-
Context: <ul></ul>
23-
]]></html>
2423
</example>
2524
<category slug="internals"/>
2625
<category slug="properties/jquery-object-instance-properties"/>

entries/deferred.isRejected.xml

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
</signature>
77
<desc> Determine whether a Deferred object has been rejected. </desc>
88
<longdesc>
9-
<p>As of jQuery 1.7 this API has been deprecated; please use <a href="/deferred.state/"><code>deferred.state()</code></a> instead.</p>
9+
<div class="warning">
10+
<p>Note: This API has been removed in jQuery 1.8; please use <a href="/deferred.state/"><code>deferred.state()</code></a> instead.</p>
11+
</div>
1012
<p>Returns <code>true</code> if the Deferred object is in the rejected state, meaning that either <a href="h/deferred.reject/"><code>deferred.reject()</code></a> or <a href="/deferred.rejectWith/"><code>deferred.rejectWith()</code></a> has been called for the object and the failCallbacks have been called (or are in the process of being called).</p>
1113
<p>Note that a Deferred object can be in one of three states: pending, resolved, or rejected; use <a href="/deferred.isResolved/"><code>deferred.isResolved()</code></a> to determine whether the Deferred object is in the resolved state. These methods are primarily useful for debugging, for example to determine whether a Deferred has already been resolved even though you are inside code that intended to reject it.</p>
1214
</longdesc>

entries/deferred.isResolved.xml

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
</signature>
77
<desc> Determine whether a Deferred object has been resolved. </desc>
88
<longdesc>
9-
<p>This API is <code>deprecated</code> as of jQuery 1.7 and <code>removed</code> as of jQuery 1.8; please use <a href="/deferred.state/"><code>deferred.state()</code></a> instead.</p>
9+
<div class="warning">
10+
<p>Note: This API has been removed in jQuery 1.8; please use <a href="/deferred.state/"><code>deferred.state()</code></a> instead.</p>
11+
</div>
1012
<p>Returns <code>true</code> if the Deferred object is in the resolved state, meaning that either <a href="/deferred.resolve/"><code>deferred.resolve()</code></a> or <a href="/deferred.resolveWith/"><code>deferred.resolveWith()</code></a> has been called for the object and the doneCallbacks have been called (or are in the process of being called).</p>
1113
<p>Note that a Deferred object can be in one of three states: pending, resolved, or rejected; use <a href="/deferred.isRejected/"><code>deferred.isRejected()</code></a> to determine whether the Deferred object is in the rejected state. These methods are primarily useful for debugging, for example to determine whether a Deferred has already been resolved even though you are inside code that intended to reject it.</p>
1214
</longdesc>

entries/die.xml

+3
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
</argument>
2222
</signature>
2323
<longdesc>
24+
<div class="warning">
25+
<p>Note: This API has been removed in jQuery 1.9; please use <a href="/on/"><code>on()</code></a> instead.</p>
26+
</div>
2427
<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>.off()</code> with no arguments, which is used to remove all handlers attached with <code>.on()</code>.
2528
See the discussions of <code>.live()</code> and <code>.off()</code> for further details.</p>
2629
<p>If used without an argument, .die() removes <em>all</em> event handlers previously attached using <code>.live()</code> from the elements.</p>

entries/error.xml

+3-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@
2020
</argument>
2121
</signature>
2222
<longdesc>
23-
<p>This method is a shortcut for <code>.on( "error", handler )</code>.</p>
24-
<p><b>As of jQuery 1.8</b>, the <code>.error()</code> method is deprecated. Use <code>.on( "error", handler )</code> to attach event handlers to the <code>error</code> event instead.</p>
23+
<div class="warning">
24+
<p>Note: This API has been removed in jQuery 3.0; please use <code>.on( "error", handler )</code> instead of <code>.error( handler )</code> and <code>.trigger( "error" )</code> instead of <code>.error()</code>.</p>
25+
</div>
2526
<p>The <code>error</code> event is sent to elements, such as images, that are referenced by a document and loaded by the browser. It is called if the element was not loaded correctly.</p>
2627
<p>For example, consider a page with a simple image element:</p>
2728
<pre><code>

entries/jQuery.boxModel.xml

+6-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,12 @@
44
<signature>
55
<added>1.0</added>
66
</signature>
7-
<desc>States if the current page, in the user's browser, is being rendered using the <a href="https://www.w3.org/TR/REC-CSS2/box.html">W3C CSS Box Model</a>. <strong>This property was removed in jQuery 1.8</strong>. Please try to use feature detection instead.</desc>
8-
<longdesc/>
7+
<desc>States if the current page, in the user's browser, is being rendered using the <a href="https://www.w3.org/TR/REC-CSS2/box.html">W3C CSS Box Model</a>.</desc>
8+
<longdesc>
9+
<div class="warning">
10+
<p>Note: This API has been removed in jQuery 3.0; check if <code>.document.compatMode</code> is equal to <code>"CSS1Compat"</code> instead. Or, even better - always specify a DOCTYPE and avoid using quirks mode which jQuery doesn't support.</p>
11+
</div>
12+
</longdesc>
913
<category slug="utilities"/>
1014
<category slug="version/1.0"/>
1115
<category slug="deprecated/deprecated-1.3"/>

entries/jQuery.browser.xml

+6
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
</signature>
88
<desc>Contains flags for the useragent, read from navigator.userAgent. <strong>This property was removed in jQuery 1.9</strong> and is available only through the jQuery.migrate plugin. Please try to use feature detection instead.</desc>
99
<longdesc>
10+
<div class="warning">
11+
<p>Note: This API has been removed in jQuery 1.9; please rely on feature detection instead.</p>
12+
</div>
1013
<p>The <code>$.browser</code> property provides information about the web browser that is accessing the page, as reported by the browser itself. It contains flags for each of the four most prevalent browser classes (Internet Explorer, Mozilla, Webkit, and Opera) as well as version information.</p>
1114
<p>Available flags are:</p>
1215
<ul>
@@ -56,6 +59,9 @@ $.browser.msie;
5659
</signature>
5760
<desc>The version number of the rendering engine for the user's browser. <strong>This property was removed in jQuery 1.9</strong> and is available only through the jQuery.migrate plugin.</desc>
5861
<longdesc>
62+
<div class="warning">
63+
<p>Note: This API has been removed in jQuery 1.9; please rely on feature detection instead.</p>
64+
</div>
5965
<p>Here are some typical results:</p>
6066
<ul>
6167
<li>Internet Explorer: 6.0, 7.0, 8.0</li>

entries/jQuery.sub.xml

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
</signature>
77
<desc>Creates a new copy of jQuery whose properties and methods can be modified without affecting the original jQuery object.</desc>
88
<longdesc>
9-
<p>
10-
<strong>This method is deprecated as of jQuery 1.7 and will be moved to a plugin in jQuery 1.8.</strong>
11-
</p>
9+
<div class="warning">
10+
<p>Note: This API has been removed in jQuery 1.9.</p>
11+
</div>
1212
<p>There are two specific use cases for which jQuery.sub() was created. The first was for providing a painless way of overriding jQuery methods without completely destroying the original methods and another was for helping to do encapsulation and basic namespacing for jQuery plugins.</p>
1313
<p>Note that jQuery.sub() doesn't attempt to do any sort of isolation - that's not its intention. All the methods on the sub'd version of jQuery will still point to the original jQuery (events bound and triggered will still be through the main jQuery, data will be bound to elements through the main jQuery, Ajax queries and events will run through the main jQuery, etc.).</p>
1414
<p>Note that if you're looking to use this for plugin development you should first <i>strongly</i> consider using something like the jQuery UI widget factory which manages both state and plugin sub-methods. <a href="http://blog.nemikor.com/2010/05/15/building-stateful-jquery-plugins/">Some examples of using the jQuery UI widget factory</a> to build a plugin.</p>

entries/live.xml

+3-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@
3232
</argument>
3333
</signature>
3434
<longdesc>
35-
<p><strong>As of jQuery 1.7</strong>, the <code>.live()</code> method is deprecated. Use <a href="/on/"><code>.on()</code></a> to attach event handlers. Users of older versions of jQuery should use <a href="/delegate/"><code>.delegate()</code></a> in preference to <code>.live()</code>.</p>
35+
<div class="warning">
36+
<p>Note: This API has been removed in jQuery 1.9; please use <a href="/on/"><code>on()</code></a> instead.</p>
37+
</div>
3638
<p>This method provides a means to attach delegated event handlers to the <code>document</code> element of a page, which simplifies the use of event handlers when content is dynamically added to a page. See the discussion of direct versus delegated events in the <a href="/on/"><code>.on()</code></a> method for more information. </p>
3739
<p>Rewriting the <code>.live()</code> method in terms of its successors is straightforward; these are templates for equivalent calls for all three event attachment methods:</p>
3840
<pre><code>

entries/load-event.xml

+3
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
</argument>
2121
</signature>
2222
<longdesc>
23+
<div class="warning">
24+
<p>Note: This API has been removed in jQuery 3.0; please use <code>.on( "load", handler )</code> instead of <code>.load( handler )</code> and <code>.trigger( "load" )</code> instead of <code>.load()</code>.</p>
25+
</div>
2326
<p>This method is a shortcut for <code>.on( "load", handler )</code>.</p>
2427
<p>The <code>load</code> event is sent to an element when it and all sub-elements have been completely loaded. This event can be sent to any element associated with a URL: images, scripts, frames, iframes, and the <code>window</code> object.</p>
2528
<p>For example, consider a page with a simple image:</p>

entries/selector.xml

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
</signature>
77
<desc>A selector representing selector passed to jQuery(), if any, when creating the original set.</desc>
88
<longdesc>
9-
<p>The <code>.selector</code> property was deprecated in jQuery 1.7 and is only maintained to the extent needed for supporting <code>.live()</code> in the jQuery Migrate plugin. It may be removed without notice in a future version. The property was never a reliable indicator of the selector that could be used to obtain the set of elements currently contained in the jQuery set where it was a property, since subsequent traversal methods may have changed the set. Plugins that need to use a selector string within their plugin can require it as a parameter of the method. For example, a "foo" plugin could be written as <code>$.fn.foo = function( selector, options ) { /* plugin code goes here */ };</code>, and the person using the plugin would write <code>$( "div.bar" ).foo( "div.bar", {dog: "bark"} );</code> with the <code>"div.bar"</code> selector repeated as the first argument of <code>.foo()</code>.</p>
9+
<div class="warning">
10+
<p>Note: This API has been removed in jQuery 3.0. The property was never a reliable indicator of the selector that could be used to obtain the set of elements currently contained in the jQuery set where it was a property, since subsequent traversal methods may have changed the set. Plugins that need to use a selector string within their plugin can require it as a parameter of the method. For example, a "foo" plugin could be written as <code>$.fn.foo = function( selector, options ) { /* plugin code goes here */ };</code>, and the person using the plugin would write <code>$( "div.bar" ).foo( "div.bar", {dog: "bark"} );</code> with the <code>"div.bar"</code> selector repeated as the first argument of <code>.foo()</code>.</p>
11+
</div>
1012
</longdesc>
1113
<category slug="internals"/>
1214
<category slug="properties/jquery-object-instance-properties"/>

entries/size.xml

+4-22
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
</signature>
77
<desc>Return the number of elements in the jQuery object.</desc>
88
<longdesc>
9-
<p>The <code>.size()</code> method is deprecated as of jQuery 1.8. Use the <code><a href="/length/">.length</a></code> property instead.</p>
9+
<div class="warning">
10+
<p>Note: This method has been removed in jQuery 3.0. Use the <code><a href="/length/">.length</a></code> property instead.</p>
11+
</div>
1012

1113
<p>The <code>.size()</code> method is functionally equivalent to the <code><a href="/length/">.length</a></code> property; however, <strong>the <code>.length</code> property is preferred</strong> because it does not have the overhead of a function call.</p>
1214
<p>Given a simple unordered list on the page:</p>
@@ -30,7 +32,7 @@ alert( "Size: " + $( "li" ).length );
3032
</p>
3133
</longdesc>
3234
<example>
33-
<desc>Count the divs. Click to add more.</desc>
35+
<desc>Count the divs.</desc>
3436
<code><![CDATA[
3537
$( document.body )
3638
.click(function() {
@@ -42,26 +44,6 @@ $( document.body )
4244
// Trigger the click to start
4345
.click();
4446
]]></code>
45-
<css><![CDATA[
46-
body {
47-
cursor: pointer;
48-
min-height: 100px;
49-
}
50-
div {
51-
width: 50px;
52-
height: 30px;
53-
margin: 5px;
54-
float: left;
55-
background: blue;
56-
}
57-
span {
58-
color: red;
59-
}
60-
]]></css>
61-
<html><![CDATA[
62-
<span></span>
63-
<div></div>
64-
]]></html>
6547
</example>
6648
<category slug="miscellaneous/dom-element-methods"/>
6749
<category slug="version/1.0"/>

entries/unload.xml

+3
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
</signature>
2121
<desc>Bind an event handler to the "unload" JavaScript event.</desc>
2222
<longdesc>
23+
<div class="warning">
24+
<p>Note: This API has been removed in jQuery 3.0; please use <code>.on( "unload", handler )</code> instead of <code>.unload( handler )</code> and <code>.trigger( "unload" )</code> instead of <code>.unload()</code>.</p>
25+
</div>
2326
<p>This method is a shortcut for <code>.on( "unload", handler )</code>.</p>
2427
<p>The <code>unload</code> event is sent to the <code>window</code> element when the user navigates away from the page. This could mean one of many things. The user could have clicked on a link to leave the page, or typed in a new URL in the address bar. The forward and back buttons will trigger the event. Closing the browser window will cause the event to be triggered. Even a page reload will first create an <code>unload</code> event.</p>
2528
<div class="warning">

entries2html.xsl

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
&lt;meta charset="utf-8"&gt;
1313
&lt;title&gt;<xsl:value-of select="//entry/@name"/> demo&lt;/title&gt;<xsl:if test="css">
1414
&lt;style&gt;<xsl:value-of select="css/text()"/> &lt;/style&gt;</xsl:if>
15-
&lt;script src="https://code.jquery.com/jquery-1.10.2.js"&gt;&lt;/script&gt;<xsl:if test="code/@location='head'">
15+
&lt;script src="https://code.jquery.com/jquery-3.4.1.js"&gt;&lt;/script&gt;<xsl:if test="code/@location='head'">
1616
&lt;script&gt;
1717
<xsl:copy-of select="code/text()"/>
1818
&lt;/script&gt;

0 commit comments

Comments
 (0)