dom/xslt/tests/mochitest/test_bug551412.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/xslt/tests/mochitest/test_bug551412.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,48 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=551412
     1.8 +-->
     1.9 +<head>
    1.10 +  <title>Test for Bug 551412</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=551412">Mozilla Bug 551412</a>
    1.16 +<p id="display"></p>
    1.17 +<div id="content" style="display: none"></div>
    1.18 +<pre id="test">
    1.19 +<script type="application/javascript">
    1.20 +
    1.21 +/** Test for Bug 551412 **/
    1.22 +
    1.23 +  var processor = new XSLTProcessor();
    1.24 +  var style =
    1.25 +    '<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" ' +
    1.26 +                    'xmlns:exsl="http://exslt.org/common" ' +
    1.27 +                    'version="1.0">' +
    1.28 +      '<xsl:output method="html"/>' +
    1.29 +      '<xsl:variable name="rtf">1 <b>2</b> 3</xsl:variable>' +
    1.30 +      '<xsl:template match="/">' +
    1.31 +        '<xsl:copy-of select="exsl:node-set($rtf)"/>' +
    1.32 +      '</xsl:template>' +
    1.33 +    '</xsl:stylesheet>';
    1.34 +  var styleDoc = new DOMParser().parseFromString (style, "text/xml");
    1.35 +
    1.36 +  var data =
    1.37 +    '<root/>';
    1.38 +  var originalDoc = new DOMParser().parseFromString(data, "text/xml");
    1.39 +
    1.40 +  processor.importStylesheet(styleDoc);
    1.41 +
    1.42 +  var fragment = processor.transformToFragment(originalDoc, document);
    1.43 +  var content = document.getElementById("content");
    1.44 +  content.appendChild(fragment);
    1.45 +  is(content.innerHTML, "1 <b>2</b> 3",
    1.46 +     "Result of transform should be '1 <b>2</b> 3'");
    1.47 +
    1.48 +</script>
    1.49 +</pre>
    1.50 +</body>
    1.51 +</html>

mercurial