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