| 1 |
wakaba |
1.1 |
<!DOCTYPE html> |
| 2 |
|
|
<html> |
| 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 compact="compact"><dt>An element with <code>compact=compact</code>.</dt></dl> |
| 10 |
|
|
|
| 11 |
|
|
<dl compact=" compact "><dt>An element with <code>compact=" compact "</code>.</dt></dl> |
| 12 |
|
|
|
| 13 |
|
|
<p id="status"></p> |
| 14 |
|
|
|
| 15 |
|
|
<script type="text/javascript"> |
| 16 |
|
|
document.getElementById ('status').appendChild |
| 17 |
|
|
(document.createTextNode ('FAIL')); |
| 18 |
|
|
var nl = document.evaluate ('//*[@compact = " compact "]', document, null, |
| 19 |
|
|
XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); |
| 20 |
|
|
for (var i = 0; i < nl.snapshotLength; i++) { |
| 21 |
|
|
nl.snapshotItem (i).style.color = 'blue'; |
| 22 |
|
|
} |
| 23 |
|
|
document.getElementById ('status').firstChild.data |
| 24 |
|
|
= '"//*[@compact = " compact "]" elements are colored blue.'; |
| 25 |
|
|
</script> |
| 26 |
|
|
<noscript>NOSCRIPT</noscript> |
| 27 |
|
|
|
| 28 |
|
|
</body> |
| 29 |
|
|
</html> |