1 <?xml version=
"1.0" encoding=
"utf-8"?>
3 <html xmlns=
"http://www.w3.org/1999/xhtml" lang=
"en" xml:
lang=
"en">
5 <title>XPath preceding axis misses nested elements
</title>
6 <style>div#msg { white-space: pre; }
</style>
9 testRunner.dumpAsText();
11 window.addEventListener(
"load", function() {
12 var msg = document.getElementById(
"msg");
13 function print(s) { msg.textContent += s; }
14 function id(el) { return el.tagName + (el.id ?
"#" + el.id :
""); }
15 function query(el, xpath, expected) {
16 print(
"Query \"" + xpath + "\
" from " + id(el) +
"\n");
17 var res = document.evaluate(xpath,
19 function() { return
"http://www.w3.org/1999/xhtml"; },
20 XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,
24 for (var i =
0; i
< res.snapshotLength; i++) {
25 var el = res.snapshotItem(i);
26 resstr +=
" " + id(el);
28 print(
"Result:" + resstr +
"\n");
29 print(
"Expected: " + expected +
"\n");
30 if (resstr != (
" " + expected)) {
31 print(
"***FAIL***\n");
33 print(
"***SUCCESS***\n");
38 print(
"Querying in the following...\n\n");
39 print(document.getElementById(
"test").outerHTML +
"\n\n");
41 query(document.getElementById(
"D"),
"preceding::xhtml:span",
"span#A span#B span#C");