jquery/test/tests/css3.html
2006-08-13 15:24:52 +00:00

80 lines
2.9 KiB
HTML

<html id="html">
<head>
<script type="text/javascript" src="../lib/Test/Builder.js"></script>
<script type="text/javascript" src="../lib/Test/More.js"></script>
<script type="text/javascript" src="../lib/test.js"></script>
<script type="text/javascript" src="../../jquery/jquery-svn.js"></script>
</head>
<body id="body">
<h1>CSS 3 Selectors</h1>
<!-- Test HTML -->
<div id="main" style="display: none;">
<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>
<p id="ap">
Here are some links in a normal paragraph: <a id="google" href="http://www.google.com/" title="Google!">Google</a>,
<a id="groups" href="http://groups.google.com/">Google Groups</a>.
This link has <code><a href="#" id="anchor1">class="blog"</a></code>:
<a href="http://diveintomark.org/" class="blog" hreflang="en" id="mark">diveintomark</a>
</p>
<div id="foo">
<p id="sndp">Everything inside the red border is inside a div with
<code>id="foo"</code>.</p>
<p lang="en" id="en">This is a normal link:
<a id="yahoo" href="http://www.yahoo.com/" class="blogTest">Yahoo</a></p>
<p id="sap">This link has <code><a href="#2" id="anchor2">class="blog"</a></code>:
<a href="http://simon.incutio.com/" class="blog link" id="simon">Simon Willison's Weblog</a></p>
</div>
<p id="first">Try them out: </p>
<ul id="first"></ul>
<ol id="empty"></ol>
<form>
<input type="text" value="Test" id="text1"/>
<input type="text" value="Test" id="text2" disabled="disabled"/>
<input type="radio" name="radio1" id="radio1"/>
<input type="radio" name="radio2" id="radio2" checked/>
<input type="checkbox" name="check" id="check1" checked/>
<input type="checkbox" name="check" id="check2"/>
</form>
</div>
<pre id="test"><script>
plan({tests: 14});
t( "Attribute Begins With", "a[@href ^= 'http://www']",
["google","yahoo"] );
t( "Attribute Ends With", "a[@href $= 'org/']",
["mark"] );
t( "Attribute Contains", "a[@href *= 'google']",
["google","groups"] );
t( "First Child", "p:first-child",
["firstp","sndp"] );
t( "Last Child", "p:last-child",
["sap"] );
t( "Only Child", "a:only-child",
["simon1","anchor1","anchor2","yahoo"] );
t( "Empty", "ol:empty", ["empty"] );
t( "Enabled UI Element", "input:enabled",
["text1","radio1","radio2","check1","check2"] );
t( "Disabled UI Element", "input:disabled",
["text2"] );
t( "Checked UI Element", "input:checked",
["radio2","check1"] );
t( "Text Contains", "a:contains('Google')",
["google","groups"] );
t( "Text Contains", "a:contains('Google Groups')",
["groups"] );
t( "Element Preceded By", "p ~ div", ["foo"] );
t( "Not", "a.blog:not(.link)", ["mark"] );
</script></pre>
</body>
</html>