57 lines
2.4 KiB
HTML
57 lines
2.4 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 1 Selectors</h1>
|
|
|
|
<!-- Test HTML -->
|
|
<div id="main" style="display: none;">
|
|
<p id="first">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>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>Everything inside the red border is inside a div with
|
|
<code>id="foo"</code>.</p><p lang="en">This is a normal link:
|
|
<a id="yahoo"href="http://www.yahoo.com/">Yahoo</a></p>
|
|
<p>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>Try them out: </p>
|
|
<ul id="first"></ul>
|
|
</div>
|
|
|
|
<pre id="test"><script>
|
|
plan({tests: 16});
|
|
|
|
t( "Element Selector", "div", ["main","foo"] );
|
|
t( "Element Selector", "body", ["body"] );
|
|
t( "Element Selector", "html", ["html"] );
|
|
cmpOK( $("*").size(), ">=", 30, "Element Selector" );
|
|
t( "Parent Element", "div div", ["foo"] );
|
|
|
|
t( "ID Selector", "#body", ["body"] );
|
|
t( "ID Selector w/ Element", "body#body", ["body"] );
|
|
cmpOK($("ul#first").get(0), "==", document.getElementsByTagName("ul")[0],
|
|
"ID Selector w/ Element");
|
|
|
|
t( "Class Selector", ".blog", ["simon","mark"] );
|
|
t( "Class Selector", ".blog.link", ["simon"] );
|
|
t( "Class Selector w/ Element", "a.blog", ["simon","mark"] );
|
|
t( "Parent Class Selector", "p .blog", ["simon","mark"] );
|
|
|
|
t( "Comma Support", "a.blog, div",
|
|
["main","foo","simon","mark"] );
|
|
t( "Comma Support", "a.blog , div",
|
|
["main","foo","simon","mark"] );
|
|
t( "Comma Support", "a.blog ,div",
|
|
["main","foo","simon","mark"] );
|
|
t( "Comma Support", "a.blog,div",
|
|
["main","foo","simon","mark"] );
|
|
</script></pre>
|
|
</body>
|
|
</html>
|