1 <!DOCTYPE html> 2 <html> 3 <head> 4 <link rel="stylesheet" href="../js/resources/js-test-style.css"> 5 <script src="../js/resources/js-test-pre.js"></script> 6 <script src="xpath-test-pre.js"></script> 7 </head> 8 <body> 9 <div id="console"></div> 10 11 <script> 12 13 var ROOT = document.createElement('div'); 14 ROOT.innerHTML = '<p>a</p><div><span id="21"></span><span id="22"></span><span id="23"></span></div>'; 15 var CHILD1 = ROOT.firstChild; 16 var CHILD1TEXT = CHILD1.firstChild; 17 var CHILD2 = ROOT.lastChild; 18 var CHILD21 = CHILD2.firstChild; 19 var CHILD22 = CHILD21.nextSibling; 20 var CHILD23 = CHILD22.nextSibling; 21 22 result = document.evaluate(".//@id[false]", ROOT, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); 23 checkSnapshot("//@id[false]", result, []); 24 25 result = document.evaluate(".//@id[1]/parent::*", ROOT, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); 26 checkSnapshot("//@id[1]/parent::*", result, [CHILD21, CHILD22, CHILD23]); 27 28 result = document.evaluate(".//@id[2]/parent::*", ROOT, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); 29 checkSnapshot("//@id[2]/parent::*", result, []); 30 31 result = document.evaluate(".//@id[string()='21']/parent::*", ROOT, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); 32 checkSnapshot("//@id[string()='21']/parent::*", result, [CHILD21]); 33 34 result = document.evaluate(".//@id[string()='22']/parent::*", ROOT, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); 35 checkSnapshot("//@id[string()='22']/parent::*", result, [CHILD22]); 36 37 var successfullyParsed = true; 38 39 </script> 40 <script src="../js/resources/js-test-post.js"></script> 41 </body> 42 </html> 43