Skip to content

Commit cf64c63

Browse files
pobockskswedberg
authored andcommitted
fixes 139 - With/Without example
1 parent b3a98ac commit cf64c63

1 file changed

Lines changed: 23 additions & 9 deletions

File tree

entries/andSelf.xml

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,33 @@
2626
<example>
2727
<desc>Find all <code>div</code>s, and all the paragraphs inside of them, and give them both class names. Notice the <code>div</code> doesn't have the yellow background color since it didn't use <code>.andSelf()</code>.</desc>
2828
<code><![CDATA[
29-
$("div").find("p").andSelf().addClass("border");
30-
$("div").find("p").addClass("background");
31-
29+
$("div.left, div.right").find("div, div > p").addClass("border");
30+
$("div.before-andself").find("p").addClass("background");
31+
$("div.after-andself").find("p").andSelf().addClass("background");
3232
]]></code>
3333
<css><![CDATA[
34-
p, div { margin:5px; padding:5px; }
35-
.border { border: 2px solid red; }
36-
.background { background:yellow; }
37-
]]></css>
38-
<html><![CDATA[<div>
34+
p, div { margin:5px; padding:5px; }
35+
.border { border: 2px solid red; }
36+
.background { background:yellow; }
37+
.left, .right { width: 45%; float: left;}
38+
.right { margin-left:3%; }
39+
]]></css>
40+
<html><![CDATA[
41+
<div class="left">
42+
<p><strong>Before <code>andSelf()</code></strong></p>
43+
<div class="before-andself">
3944
<p>First Paragraph</p>
4045
<p>Second Paragraph</p>
41-
</div>]]></html>
46+
</div>
47+
</div>
48+
<div class="right">
49+
<p><strong>After <code>andSelf()</code></strong></p>
50+
<div class="after-andself">
51+
<p>First Paragraph</p>
52+
<p>Second Paragraph</p>
53+
</div>
54+
</div>
55+
]]></html>
4256
</example>
4357
<category slug="traversing/miscellaneous-traversal"/>
4458
<category slug="version/1.2"/>

0 commit comments

Comments
 (0)