test_bug636336.html (1176B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=636336 5 --> 6 <head> 7 <title>Test for Bug 636336</title> 8 <script 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=636336">Mozilla Bug 636336</a> 13 <p id="display"></p> 14 <div id="content" style="display: none"> 15 16 </div> 17 <pre id="test"> 18 <script type="application/javascript"> 19 20 /** Test for Bug 636336 */ 21 function testIt(tag) { 22 var elem = document.createElement(tag); 23 elem.setAttribute("src", " "); 24 is(elem.getAttribute("src"), " ", 25 tag + " src attribute setter should not strip whitespace"); 26 elem.setAttribute("src", " test "); 27 is(elem.getAttribute("src"), " test ", 28 tag + " src attribute setter should not strip whitespace around non-whitespace"); 29 is(elem.src, window.location.href.replace(/\?.*/, "") 30 .replace(/test_bug636336\.html$/, "test"), 31 tag + ".src should strip whitespace as needed"); 32 } 33 34 testIt("img"); 35 testIt("source"); 36 testIt("audio"); 37 testIt("video"); 38 </script> 39 </pre> 40 </body> 41 </html>