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 |
|
|
<div>A <code>div</code> element.</div> |
9 |
|
|
|
10 |
|
|
<Div>A <code>Div</code> element.</Div> |
11 |
|
|
|
12 |
|
|
<DIV>A <code>DIV</code> element.</DIV> |
13 |
|
|
|
14 |
|
|
<p id="status"></p> |
15 |
|
|
|
16 |
|
|
<script type="text/javascript"><![CDATA[ |
17 |
|
|
document.getElementById ('status').appendChild |
18 |
|
|
(document.createTextNode ('FAIL')); |
19 |
|
|
var nl = document.evaluate ('//Div', document, function () { |
20 |
|
|
return 'http://www.w3.org/1999/xhtml'; |
21 |
|
|
}, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); |
22 |
|
|
for (var i = 0; i < nl.snapshotLength; i++) { |
23 |
|
|
nl.snapshotItem (i).style.color = 'blue'; |
24 |
|
|
} |
25 |
|
|
document.getElementById ('status').firstChild.data |
26 |
|
|
= '"//Div" elements are colored blue.'; |
27 |
|
|
]]></script> |
28 |
|
|
<noscript>NOSCRIPT</noscript> |
29 |
|
|
|
30 |
|
|
</body> |
31 |
|
|
</html> |