Bug 1942639 - Propagate --filter argument from desktop_unittest.py to runreftest...
[gecko.git] / dom / xslt / tests / mochitest / test_bug440974.html
blob40745ae210f969cbb4c7447a5d98ee3e3cdeba4b
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=440974
5 -->
6 <head>
7 <title>Test for Bug 440974</title>
8 <script src="/tests/SimpleTest/SimpleTest.js"></script>
9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
10 </head>
11 <body>
12 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=440974">Mozilla Bug 440974</a>
13 <p id="display"></p>
14 <div id="content" style="display: none">
16 </div>
17 <pre id="test">
18 <script class="testbody" type="text/javascript">
20 /** Test for Bug 440974 **/
22 function isTxResult(node)
24 return node.namespaceURI == "http://www.mozilla.org/TransforMiix" &&
25 node.localName == "result";
28 var xmldoc, xsltdoc;
30 xmldoc = new DOMParser().parseFromString('<items><item><id>1</id></item><item><id>2</id></item><item><id>3</id></item></items>', "text/xml");
31 xsltdoc = new DOMParser().parseFromString('<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">\n\
32 <xsl:output method="xml" />\n\
33 <xsl:template match="item"><foo id="{id}"/></xsl:template>\n\
34 </xsl:stylesheet>', "text/xml");
36 var processor = new XSLTProcessor;
37 processor.importStylesheet(xsltdoc);
38 var result = processor.transformToDocument(xmldoc);
39 var resultElements = Array.prototype.filter.call(result.getElementsByTagName('*'), isTxResult);
40 is(resultElements.length, 1, "there should be only one 'transformiix:result' element");
41 is(resultElements[0], result.documentElement, "the 'transformiix:result' element should be the document element");
43 </script>
44 </pre>
45 </body>
46 </html>