4 https://bugzilla.mozilla.org/show_bug.cgi?id=566629
7 <title>Test for Bug
566629</title>
8 <script src=
"/tests/SimpleTest/SimpleTest.js"></script>
9 <link rel=
"stylesheet" type=
"text/css" href=
"/tests/SimpleTest/test.css" />
12 <a target=
"_blank" href=
"https://bugzilla.mozilla.org/show_bug.cgi?id=566629">Mozilla Bug
566629</a>
14 <div id=
"content" style=
"display: none">
18 <script class=
"testbody" type=
"text/javascript">
20 /** Test for Bug
566629 **/
22 var xsltdoc = new DOMParser().parseFromString(
23 '
<xsl:stylesheet version=
"1.0" xmlns:
xsl=
"http://www.w3.org/1999/XSL/Transform"\
24 xmlns:
xhtml=
"http://www.w3.org/1999/xhtml">\
25 <xsl:template match=
"/">\
26 <xsl:value-of select=
"count(//body)"/>\
27 <xsl:text>,
</xsl:text>\
28 <xsl:value-of select=
"count(//xhtml:body)"/>\
29 <xsl:text>,
</xsl:text>\
30 <xsl:value-of select=
"count(//xsl:body)"/>\
31 <xsl:text>,
</xsl:text>\
32 <xsl:value-of select=
"name(//body)"/>\
33 <xsl:text>,
</xsl:text>\
34 <xsl:value-of select=
"local-name(//body)"/>\
39 var processor = new XSLTProcessor;
40 processor.importStylesheet(xsltdoc);
41 var result = processor.transformToFragment(document, document);
42 ok(result instanceof DocumentFragment,
"returned a docfragment");
43 is(result.firstChild.nodeValue,
"1,1,0,BODY,body",
44 "correct treatment of HTML elements in XSLT");
46 is(document.evaluate(
"count(//body)", document, null, XPathResult.ANY_TYPE, null).numberValue,
47 1,
"namespace-less node-test");
48 is(document.evaluate(
"count(//a:body)", document,
49 function() { return
"http://www.w3.org/1999/xhtml" },
50 XPathResult.ANY_TYPE, null).numberValue,
51 1,
"with-namespace node-test");
52 is(document.evaluate(
"count(//a:body)", document,
53 function() { return
"foo" },
54 XPathResult.ANY_TYPE, null).numberValue,
55 0,
"wrong-namespace node-test");
56 is(document.evaluate(
"//bODy", document, null, XPathResult.ANY_TYPE, null).iterateNext(),
57 document.body,
"case insensitive matching");
58 is(document.evaluate(
"count(//a:bODy)", document,
59 function() { return
"http://www.w3.org/1999/xhtml" },
60 XPathResult.ANY_TYPE, null).numberValue,
61 0,
"with-namespace but wrong casing node-test");
62 is(document.evaluate(
"name(//body)", document, null, XPathResult.ANY_TYPE, null).stringValue,
63 "BODY",
"uppercase name() function");
64 is(document.evaluate(
"local-name(//body)", document, null, XPathResult.ANY_TYPE, null).stringValue,
65 "body",
"lowercase local-name() function");