Bug 1942639 - Propagate --filter argument from desktop_unittest.py to runreftest...
[gecko.git] / dom / xslt / tests / mochitest / test_bug566629.xhtml
blob0880a360023b455e6e7f0dcc0cbe681427b4de15
1 <html xmlns="http://www.w3.org/1999/xhtml">
2 <!--
3 https://bugzilla.mozilla.org/show_bug.cgi?id=566629
4 -->
5 <head>
6 <title>Test for Bug 566629</title>
7 <script src="/tests/SimpleTest/SimpleTest.js"></script>
8 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
9 </head>
10 <body>
11 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=566629">Mozilla Bug 566629</a>
12 <p id="display"></p>
13 <div id="content" style="display: none">
15 </div>
16 <pre id="test">
17 <script class="testbody" type="text/javascript">
18 <![CDATA[
19 /** Test for Bug 566629 **/
21 var xsltdoc = new DOMParser().parseFromString(
22 '<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"\
23 xmlns:xhtml="http://www.w3.org/1999/xhtml">\
24 <xsl:template match="/">\
25 <xsl:value-of select="count(//body)"/>\
26 <xsl:text>,</xsl:text>\
27 <xsl:value-of select="count(//xhtml:body)"/>\
28 <xsl:text>,</xsl:text>\
29 <xsl:value-of select="count(//xsl:body)"/>\
30 <xsl:text>,</xsl:text>\
31 <xsl:value-of select="name(//xhtml:body)"/>\
32 <xsl:text>,</xsl:text>\
33 <xsl:value-of select="local-name(//xhtml:body)"/>\
34 </xsl:template>\
35 </xsl:stylesheet>',
36 "text/xml");
38 var processor = new XSLTProcessor;
39 processor.importStylesheet(xsltdoc);
40 var result = processor.transformToFragment(document, document);
41 ok(result instanceof DocumentFragment, "returned a docfragment");
42 is(result.firstChild.nodeValue, "0,1,0,body,body",
43 "correct treatment of HTML elements in XSLT");
45 is(document.evaluate("count(//body)", document, null, XPathResult.ANY_TYPE, null).numberValue,
46 0, "namespace-less node-test");
47 is(document.evaluate("count(//a:body)", document,
48 function() { return "http://www.w3.org/1999/xhtml" },
49 XPathResult.ANY_TYPE, null).numberValue,
50 1, "with-namespace node-test");
51 is(document.evaluate("count(//a:body)", document,
52 function() { return "foo" },
53 XPathResult.ANY_TYPE, null).numberValue,
54 0, "wrong-namespace node-test");
55 is(document.evaluate("count(//a:bODy)", document,
56 function() { return "http://www.w3.org/1999/xhtml" },
57 XPathResult.ANY_TYPE, null).numberValue,
58 0, "with-namespace wrong-casing node-test");
59 is(document.evaluate("count(//bODy)", document, null, XPathResult.ANY_TYPE, null).numberValue,
60 0, "without-namespace wrong-casing node-test");
61 is(document.evaluate("name(//a:body)", document,
62 function() { return "http://www.w3.org/1999/xhtml" },
63 XPathResult.ANY_TYPE, null).stringValue,
64 "body", "name()");
65 is(document.evaluate("local-name(//a:body)", document,
66 function() { return "http://www.w3.org/1999/xhtml" },
67 XPathResult.ANY_TYPE, null).stringValue,
68 "body", "local-name()");
69 ]]>
70 </script>
71 </pre>
72 </body>
73 </html>