ced1f9ca7ab371f0a0f2c90424f6d6937560f67e
[jquery.git] / test / tests / css3.html
1 <html id="html">
2 <head>
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>
7 </head>
8 <body id="body">
9         <h1>CSS 3 Selectors</h1>
10
11         <!-- Test HTML -->
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> for more information.</p>
14                 <p id="ap">
15                         Here are some links in a normal paragraph: <a id="google" href="http://www.google.com/" title="Google!">Google</a>, 
16                         <a id="groups" href="http://groups.google.com/">Google Groups</a>. 
17                         This link has <code><a href="#" id="anchor1">class="blog"</a></code>: 
18                         <a href="http://diveintomark.org/" class="blog" hreflang="en" id="mark">diveintomark</a>
19                 </p>
20                 <div id="foo">
21                         <p id="sndp">Everything inside the red border is inside a div with 
22                                 <code>id="foo"</code>.</p>
23                         <p lang="en" id="en">This is a normal link: 
24                                 <a id="yahoo" href="http://www.yahoo.com/" class="blogTest">Yahoo</a></p>
25                         <p id="sap">This link has <code><a href="#2" id="anchor2">class="blog"</a></code>: 
26                                 <a href="http://simon.incutio.com/" class="blog link" id="simon">Simon Willison's Weblog</a></p>
27                 </div>
28                 <p id="first">Try them out: </p>
29                 <ul id="first"></ul>
30                 <ol id="empty"></ol>
31                 <form>
32                         <input type="text" value="Test" id="text1"/>
33                         <input type="text" value="Test" id="text2" disabled="disabled"/>
34                         <input type="radio" name="radio1" id="radio1"/>
35                         <input type="radio" name="radio2" id="radio2" checked/>
36                         <input type="checkbox" name="check" id="check1" checked/>
37                         <input type="checkbox" name="check" id="check2"/>
38                         </form>
39         </div>
40
41         <pre id="test"><script>
42                 plan({tests: 14});
43                         
44                 t( "Attribute Begins With", "a[@href ^= 'http://www']",
45                         ["google","yahoo"] );
46                 t( "Attribute Ends With", "a[@href $= 'org/']",
47                         ["mark"] );
48                 t( "Attribute Contains", "a[@href *= 'google']",
49                         ["google","groups"] );
50         
51                 t( "First Child", "p:first-child",
52                         ["firstp","sndp"] );
53                 t( "Last Child", "p:last-child",
54                         ["sap"] );
55         
56                 t( "Only Child", "a:only-child",
57                         ["simon1","anchor1","anchor2","yahoo"] );
58         
59                 t( "Empty", "ol:empty", ["empty"] );
60         
61                 t( "Enabled UI Element", "input:enabled",
62                         ["text1","radio1","radio2","check1","check2"] );
63                 t( "Disabled UI Element", "input:disabled",
64                         ["text2"] );
65       
66                 t( "Checked UI Element", "input:checked",
67                         ["radio2","check1"] );
68         
69                 t( "Text Contains", "a:contains('Google')",
70                         ["google","groups"] );
71                 t( "Text Contains", "a:contains('Google Groups')",
72                         ["groups"] );
73         
74                 t( "Element Preceded By", "p ~ div", ["foo"] );
75        
76                 t( "Not", "a.blog:not(.link)", ["mark"] );
77         </script></pre>
78 </body>
79 </html>