4 <script src=
"../../resources/js-test.js"></script>
7 <p>This tests XPath expressions on detached document fragments and nodes.
8 <br/>See https://bugs.webkit.org/show_bug.cgi?id=
36427
9 <div id=
"console"></div>
12 frag
= document
.createDocumentFragment();
13 child
= document
.createElement('div');
14 frag
.appendChild(child
);
15 child
.appendChild(document
.createElement('h2'));
16 shouldBe("document.evaluate('count(/div)', child, null, XPathResult.NUMBER_TYPE, null).numberValue",
18 shouldBe("document.evaluate('count(/html)', child, null, XPathResult.NUMBER_TYPE, null).numberValue",
20 shouldBe("document.evaluate('count(/)', child, null, XPathResult.NUMBER_TYPE, null).numberValue",
22 shouldBe("document.evaluate('count(//html)', child, null, XPathResult.NUMBER_TYPE, null).numberValue",
24 shouldBe("document.evaluate('count(//div)', child, null, XPathResult.NUMBER_TYPE, null).numberValue",
26 shouldBe("document.evaluate('count(//h2)', child, null, XPathResult.NUMBER_TYPE, null).numberValue",
29 ele
= document
.createElement('p');
30 ele
.appendChild(document
.createElement('h1'));
31 shouldBe("document.evaluate('count(/h1)', ele, null, XPathResult.NUMBER_TYPE, null).numberValue",
33 shouldBe("document.evaluate('count(/html)', ele, null, XPathResult.NUMBER_TYPE, null).numberValue",
35 shouldBe("document.evaluate('count(/)', ele, null, XPathResult.NUMBER_TYPE, null).numberValue",
37 shouldBe("document.evaluate('count(//html)', ele, null, XPathResult.NUMBER_TYPE, null).numberValue",
39 shouldBe("document.evaluate('count(//p)', ele, null, XPathResult.NUMBER_TYPE, null).numberValue",
41 shouldBe("document.evaluate('count(//h1)', ele, null, XPathResult.NUMBER_TYPE, null).numberValue",
43 shouldBe("document.evaluate('/* | *', ele, null, XPathResult.NUMBER_TYPE, null).numberValue",