dom/xslt/tests/mochitest/test_bug551654.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/xslt/tests/mochitest/test_bug551654.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,49 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=551654
     1.8 +-->
     1.9 +<head>
    1.10 +  <title>Test for Bug 551654</title>
    1.11 +  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.12 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    1.13 +</head>
    1.14 +<body>
    1.15 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=551654">Mozilla Bug 551654</a>
    1.16 +<p id="display"></p>
    1.17 +<div id="content" style="display: none">
    1.18 +  
    1.19 +</div>
    1.20 +<pre id="test">
    1.21 +<script type="application/javascript">
    1.22 +
    1.23 +/** Test for Bug 551654 **/
    1.24 +
    1.25 +  var didTransform = false;
    1.26 +  var processor = new XSLTProcessor();
    1.27 +  var style =
    1.28 +    '<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" ' +
    1.29 +                    'xmlns:exsl="http://exslt.org/common" ' +
    1.30 +                    'version="1.0">' +
    1.31 +      '<xsl:output method="html"/>' +
    1.32 +      '<xsl:template match="/">' +
    1.33 +        '<xsl:copy-of select="exsl:node-set(42)"/>' +
    1.34 +      '</xsl:template>' +
    1.35 +    '</xsl:stylesheet>';
    1.36 +  var styleDoc = new DOMParser().parseFromString (style, "text/xml");
    1.37 +
    1.38 +  var data =
    1.39 +    '<root/>';
    1.40 +  var originalDoc = new DOMParser().parseFromString(data, "text/xml");
    1.41 +
    1.42 +  processor.importStylesheet(styleDoc);
    1.43 +  var fragment = processor.transformToFragment(originalDoc, document);
    1.44 +  is(fragment.firstChild.nodeType, Node.TEXT_NODE,
    1.45 +     "Result of transform should be a textnode");
    1.46 +  is(fragment.firstChild.nodeValue, "42",
    1.47 +     "Result of transform should be a textnode with value '42'");
    1.48 +
    1.49 +</script>
    1.50 +</pre>
    1.51 +</body>
    1.52 +</html>

mercurial