You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: entries/parent-selector.xml
+13-6Lines changed: 13 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -10,19 +10,26 @@
10
10
<p>This is the inverse of <code>:empty</code>. </p>
11
11
<p>One important thing to note regarding the use of <code>:parent</code> (and <code>:empty</code>) is that child nodes include text nodes.</p>
12
12
<p>The W3C recommends that the <code><p></code> element have at least one child node, even if that child is merely text (see <ahref="http://www.w3.org/TR/html401/struct/text.html#edef-P">http://www.w3.org/TR/html401/struct/text.html#edef-P</a>). Some other elements, on the other hand, are empty (i.e. have no children) by definition:<code> <input></code>, <code><img></code>, <code><br></code>, and <code><hr></code>, for example.</p>
13
-
<p>To obtain the parents or ancestors of an existing jQuery set, see the <code><ahref="http://api.jquery.com/parent/">.parent()</a></code> and <code><ahref="http://api.jquery.com/parents/">.parents()</a></code> methods.</p>
13
+
<p>To obtain the parents or ancestors of an existing jQuery set, see the <code><ahref="/parent/">.parent()</a></code> and <code><ahref="/parents/">.parents()</a></code> methods.</p>
Copy file name to clipboardExpand all lines: entries/parent.xml
+37-29Lines changed: 37 additions & 29 deletions
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@
10
10
<desc>Get the parent of each element in the current set of matched elements, optionally filtered by a selector.</desc>
11
11
<longdesc>
12
12
<p>Given a jQuery object that represents a set of DOM elements, the <code>.parent()</code> method allows us to search through the parents of these elements in the DOM tree and construct a new jQuery object from the matching elements.</p>
13
-
<p>The <code><ahref="/parents/">.parents()</a></code> and <code>.parent()</code> methods are similar, except that the latter only travels a single level up the DOM tree. Also, <code>$("html").parent()</code> method returns a set containing <code>document</code> whereas <code>$("html").parents()</code> returns an empty set.</p>
13
+
<p>The <code><ahref="/parents/">.parents()</a></code> and <code>.parent()</code> methods are similar, except that the latter only travels a single level up the DOM tree. Also, <code>$("html").parent()</code> method returns a set containing <code>document</code> whereas <code>$("html").parents()</code> returns an empty set.</p>
14
14
<p>The method optionally accepts a selector expression of the same type that we can pass to the <code>$()</code> function. If the selector is supplied, the elements will be filtered by testing whether they match it.</p>
15
15
<p>Consider a page with a basic nested list on it:</p>
16
16
<pre><code>
@@ -33,47 +33,55 @@
33
33
</ul>
34
34
</code></pre>
35
35
<p>If we begin at item A, we can find its parents:</p>
<p>The result of this call is a red background for the level-2 list. Since we do not supply a selector expression, the parent element is unequivocally included as part of the object. If we had supplied one, the element would be tested for a match before it was included.</p>
38
40
</longdesc>
39
41
<example>
40
42
<desc>Shows the parent of each element as (parent > child). Check the View Source to see the raw html.</desc>
Copy file name to clipboardExpand all lines: entries/parents.xml
+64-41Lines changed: 64 additions & 41 deletions
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@
10
10
<desc>Get the ancestors of each element in the current set of matched elements, optionally filtered by a selector.</desc>
11
11
<longdesc>
12
12
<p>Given a jQuery object that represents a set of DOM elements, the <code>.parents()</code> method allows us to search through the ancestors of these elements in the DOM tree and construct a new jQuery object from the matching elements ordered from immediate parent on up; the elements are returned in order from the closest parent to the outer ones. When multiple DOM elements are in the original set, the resulting set will be in <em>reverse</em> order of the original elements as well, with duplicates removed.</p>
13
-
<p>The <code>.parents()</code> and <code><ahref="http://api.jquery.com/parent/">.parent()</a></code> methods are similar, except that the latter only travels a single level up the DOM tree. Also, <code>$("html").parent()</code> method returns a set containing <code>document</code> whereas <code>$("html").parents()</code> returns an empty set.</p>
13
+
<p>The <code>.parents()</code> and <code><ahref="/parent/">.parent()</a></code> methods are similar, except that the latter only travels a single level up the DOM tree. Also, <code>$("html").parent()</code> method returns a set containing <code>document</code> whereas <code>$("html").parents()</code> returns an empty set.</p>
14
14
<p>The method optionally accepts a selector expression of the same type that we can pass to the <code>$()</code> function. If the selector is supplied, the elements will be filtered by testing whether they match it.</p>
15
15
<p>Consider a page with a basic nested list on it:</p>
16
16
<pre><code>
@@ -31,73 +31,96 @@
31
31
</li>
32
32
<li class="item-iii">III</li>
33
33
</ul>
34
-
</code></pre>
34
+
</code></pre>
35
35
<p>If we begin at item A, we can find its ancestors:</p>
<p>The result of this call is a red background for the level-2 list, item II, and the level-1 list (and on up the DOM tree all the way to the <code><html></code> element). Since we do not supply a selector expression, all of the ancestors are part of the returned jQuery object. If we had supplied one, only the matching items among these would be included.</p>
Copy file name to clipboardExpand all lines: entries/parentsUntil.xml
+9-7Lines changed: 9 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -30,12 +30,13 @@
30
30
<height>220px</height>
31
31
<desc>Find the ancestors of <li class="item-a"> up to <ul class="level-1"> and give them a red background color. Also, find ancestors of <li class="item-2"> that have a class of "yes" up to <ul class="level-1"> and give them a green border.</desc>
Copy file name to clipboardExpand all lines: entries/password-selector.xml
+37-29Lines changed: 37 additions & 29 deletions
Original file line number
Diff line number
Diff line change
@@ -7,43 +7,51 @@
7
7
</signature>
8
8
<desc>Selects all elements of type password.</desc>
9
9
<longdesc>
10
-
<p><code>$(':password')</code> is equivalent to <code>$('[type=password]')</code>. As with other pseudo-class selectors (those that begin with a ":") it is recommended to precede it with a tag name or some other selector; otherwise, the universal selector ("*") is implied. In other words, the bare <code>$(':password')</code> is equivalent to <code>$('*:password')</code>, so <code>$('input:password')</code> should be used instead. </p>
10
+
<p><code>$( ":password" )</code> is equivalent to <code>$( "[type=password]" )</code>. As with other pseudo-class selectors (those that begin with a ":") it is recommended to precede it with a tag name or some other selector; otherwise, the universal selector ("*") is implied. In other words, the bare <code>$( ":password" )</code> is equivalent to <code>$( "*:password" )</code>, so <code>$( "input:password" )</code> should be used instead. </p>
0 commit comments