/parser/htmlparser/tests/mochitest/test_bug339350.xhtml

http://github.com/zpao/v8monkey · XHTML · 60 lines · 54 code · 6 blank · 0 comment · 0 complexity · 97553df5123ea1d4dd50bfa3c6a96b29 MD5 · raw file

  1. <html xmlns="http://www.w3.org/1999/xhtml">
  2. <!--
  3. Tests by Sam Ruby - WTFPL License (http://sam.zoy.org/wtfpl/)
  4. http://www.intertwingly.net/blog/2006/10/03/Firefox-XHTML-innerHTML-quirk#comments
  5. https://bugzilla.mozilla.org/show_bug.cgi?id=339350
  6. -->
  7. <head>
  8. <!-- XHTML needs the packed version -->
  9. <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"/>
  10. <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
  11. </head>
  12. <body>
  13. <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=339350">Mozilla Bug 339350</a>
  14. <div style="display: none">
  15. <table border="1" cellspacing="0">
  16. <thead>
  17. <th></th>
  18. <th>plain</th>
  19. <th>brackets</th>
  20. <th>braces</th>
  21. </thead>
  22. <tr>
  23. <th>innerHTML</th>
  24. <td><div id="i1"/></td>
  25. <td style="background:yellow"><div id="i2"/></td>
  26. <td><div id="i3"/></td>
  27. </tr>
  28. <tr>
  29. <th>textNode</th>
  30. <td><div id="t1"/></td>
  31. <td><div id="t2"/></td>
  32. <td><div id="t3"/></td>
  33. </tr>
  34. </table>
  35. </div>
  36. <pre id="test">
  37. <script type="text/javascript">
  38. var text1 = 'foo bar';
  39. var text2 = 'foo [bar]';
  40. var text3 = 'foo {bar}';
  41. <!-- This is the long way to write this stuff,
  42. you can use MochiKit functions too -->
  43. document.getElementById('i1').innerHTML = text1;
  44. document.getElementById('i2').innerHTML = text2;
  45. document.getElementById('i3').innerHTML = text3;
  46. document.getElementById('t1').appendChild(document.createTextNode(text1));
  47. document.getElementById('t2').appendChild(document.createTextNode(text2));
  48. document.getElementById('t3').appendChild(document.createTextNode(text3));
  49. <!-- The is() function is one way to add a test -->
  50. is(document.getElementById('i2').innerHTML, text2, "XHTML innerHTML with trailing brackets ']]'");
  51. </script>
  52. </pre>
  53. </body>
  54. </html>