3 <script type="text/javascript" src="../lib/Test/Builder.js"></script>
4 <script type="text/javascript" src="../lib/Test/More.js"></script>
5 <script type="text/javascript" src="../lib/test.js"></script>
6 <script type="text/javascript" src="../../jquery/jquery-svn.js"></script>
9 <h1>XPath Expressions</h1>
12 <div id="main" style="display: none;">
13 <p id="firstp">See <a id="simon1" href="http://simon.incutio.com/archive/2003/03/25/#getElementsBySelector" rel="bookmark">this blog entry</a>
14 for more information.</p>
15 <p id="ap">Here are some links in a normal paragraph:
16 <a id="google" href="http://www.google.com/" title="Google!">Google</a>,
17 <a id="groups" href="http://groups.google.com/">Google Groups</a>.
18 This link has <code><a href="#" id="anchor1">class="blog"</a></code>:
19 <a href="http://diveintomark.org/" class="blog" hreflang="en" id="mark">diveintomark</a>
22 <p id="sndp">Everything inside the red border is inside a div with
23 <code>id="foo"</code>.</p>
24 <p lang="en" id="en">This is a normal link:
25 <a id="yahoo" href="http://www.yahoo.com/" class="blogTest">Yahoo</a>
27 <p id="sap">This link has <code><a href="#2" id="anchor2">class="blog"</a></code>:
28 <a href="http://simon.incutio.com/" class="blog link" id="simon">Simon Willison's Weblog</a>
31 <p id="first">Try them out: </p>
34 <input type="text" value="Test" id="text1"/>
35 <input type="text" value="Test" id="text2" disabled="disabled"/>
36 <input type="radio" name="radio1" id="radio1"/>
37 <input type="radio" name="radio2" id="radio2" checked/>
38 <input type="checkbox" name="check" id="check1" checked/>
39 <input type="checkbox" name="check" id="check2"/>
43 <pre id="test"><script>
46 cmpOK( $.find("//*").length, ">=", 30, "All Elements (//*)" );
47 t( "All Div Elements", "//div", ["main","foo"] );
49 t( "Absolute Path", "/html/body", ["body"] );
50 t( "Absolute Path w/ *", "/*/body", ["body"] );
51 t( "Long Absolute Path", "/html/body/div/div/p", ["sndp","en","sap"] );
53 t( "Absolute and Relative Paths", "/html//div", ["main","foo"] );
55 t( "All Children, Explicit", "//code/*", ["anchor1","anchor2"] );
56 t( "All Children, Implicit", "//code/", ["anchor1","anchor2"] );
58 t( "Attribute Exists", "//a[@title]", ["google"] );
59 t( "Attribute Equals", "//a[@rel='bookmark']", ["simon1"] );
61 t( "Parent Axis", "//p/..", ["main","foo"] );
62 t( "Sibling Axis", "//p/../",
63 ["firstp","ap","foo","first","empty","form","sndp","en","sap"] );
64 t( "Sibling Axis", "//p/../*",
65 ["firstp","ap","foo","first","empty","form","sndp","en","sap"] );
67 t( "Has Children", "//p[a]",
68 ["firstp","ap","en","sap"] );