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