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 class="a">An element with <code>class</code>.</div> |
9 |
|
10 |
<div Class="b">An element with <code>Class</code>.</div> |
11 |
|
12 |
<div CLASS="c">An element with <code>CLASS</code>.</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 ('//*[@node ()[local-name () = "class"]]', document, null, |
20 |
XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); |
21 |
for (var i = 0; i < nl.snapshotLength; i++) { |
22 |
nl.snapshotItem (i).style.color = 'blue'; |
23 |
} |
24 |
document.getElementById ('status').firstChild.data |
25 |
= '"//*[@node ()[local-name () = "class"]]" elements are colored blue.'; |
26 |
]]></script> |
27 |
<noscript>NOSCRIPT</noscript> |
28 |
|
29 |
</body> |
30 |
</html> |