1 |
wakaba |
1.1 |
<html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml"> |
2 |
|
|
<head> |
3 |
|
|
<title>DOM3 XPath vs XHTML Document</title> |
4 |
|
|
</head> |
5 |
|
|
<body> |
6 |
|
|
<h1>DOM3 XPath vs XHTML Document</h1> |
7 |
|
|
|
8 |
|
|
<dl><dt>An element with<em>out</em> <code>compact</code>.</dt></dl> |
9 |
|
|
|
10 |
|
|
<!--<dl compact><dt>An element with <code>compact</code>.</dt></dl>--> |
11 |
|
|
|
12 |
|
|
<dl compact=""><dt>An element with <code>compact=""</code>.</dt></dl> |
13 |
|
|
|
14 |
|
|
<dl compact="compact"><dt>An element with <code>compact=compact</code>.</dt></dl> |
15 |
|
|
|
16 |
|
|
<p id="status"></p> |
17 |
|
|
|
18 |
|
|
<script type="text/javascript"><![CDATA[ |
19 |
|
|
document.getElementById ('status').appendChild |
20 |
|
|
(document.createTextNode ('FAIL')); |
21 |
|
|
var nl = document.evaluate ('//*[@compact = "compact"]', document, null, |
22 |
|
|
XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); |
23 |
|
|
for (var i = 0; i < nl.snapshotLength; i++) { |
24 |
|
|
nl.snapshotItem (i).style.color = 'blue'; |
25 |
|
|
} |
26 |
|
|
document.getElementById ('status').firstChild.data |
27 |
|
|
= '"//*[@compact = "compact"]" elements are colored blue.'; |
28 |
|
|
]]></script> |
29 |
|
|
<noscript>NOSCRIPT</noscript> |
30 |
|
|
|
31 |
|
|
</body> |
32 |
|
|
</html> |