test_bug453441.html 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <!DOCTYPE HTML>
  2. <html>
  3. <!--
  4. https://bugzilla.mozilla.org/show_bug.cgi?id=453441
  5. -->
  6. <head>
  7. <title>Test for Bug 453441</title>
  8. <script type="text/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=453441">Mozilla Bug 453441</a>
  13. <p id="display"></p>
  14. <div id="content" style="display: none">
  15. </div>
  16. <pre id="test">
  17. <script class="testbody" type="text/javascript">
  18. /** Test for Bug 453441 **/
  19. function tryImportStylesheet(xml, valid)
  20. {
  21. var processor = new XSLTProcessor;
  22. var xsltdoc = new DOMParser().parseFromString(xml, "text/xml");
  23. try
  24. {
  25. processor.importStylesheet(xsltdoc);
  26. ok(valid, "should be able to parse this XSLT stylesheet");
  27. }
  28. catch (e)
  29. {
  30. ok(!valid, "should not be able to parse this XSLT stylesheet");
  31. }
  32. }
  33. tryImportStylesheet(
  34. '<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">\n\
  35. <xsl:template match="/">\n\
  36. <html xmlns="http://www.w3.org/1999/xhtml" xsl:version="1.0" />\n\
  37. </xsl:template>\n\
  38. </xsl:stylesheet>'
  39. , true);
  40. tryImportStylesheet(
  41. '<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" />'
  42. , false);
  43. tryImportStylesheet(
  44. '<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" />'
  45. , false);
  46. </script>
  47. </pre>
  48. </body>
  49. </html>