dom/xslt/tests/mochitest/test_bug551654.html

Fri, 16 Jan 2015 18:13:44 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 18:13:44 +0100
branch
TOR_BUG_9701
changeset 14
925c144e1f1f
permissions
-rw-r--r--

Integrate suggestion from review to improve consistency with existing code.

     1 <!DOCTYPE HTML>
     2 <html>
     3 <!--
     4 https://bugzilla.mozilla.org/show_bug.cgi?id=551654
     5 -->
     6 <head>
     7   <title>Test for Bug 551654</title>
     8   <script type="application/javascript" 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=551654">Mozilla Bug 551654</a>
    13 <p id="display"></p>
    14 <div id="content" style="display: none">
    16 </div>
    17 <pre id="test">
    18 <script type="application/javascript">
    20 /** Test for Bug 551654 **/
    22   var didTransform = false;
    23   var processor = new XSLTProcessor();
    24   var style =
    25     '<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" ' +
    26                     'xmlns:exsl="http://exslt.org/common" ' +
    27                     'version="1.0">' +
    28       '<xsl:output method="html"/>' +
    29       '<xsl:template match="/">' +
    30         '<xsl:copy-of select="exsl:node-set(42)"/>' +
    31       '</xsl:template>' +
    32     '</xsl:stylesheet>';
    33   var styleDoc = new DOMParser().parseFromString (style, "text/xml");
    35   var data =
    36     '<root/>';
    37   var originalDoc = new DOMParser().parseFromString(data, "text/xml");
    39   processor.importStylesheet(styleDoc);
    40   var fragment = processor.transformToFragment(originalDoc, document);
    41   is(fragment.firstChild.nodeType, Node.TEXT_NODE,
    42      "Result of transform should be a textnode");
    43   is(fragment.firstChild.nodeValue, "42",
    44      "Result of transform should be a textnode with value '42'");
    46 </script>
    47 </pre>
    48 </body>
    49 </html>

mercurial