test_bug456244.html (2062B)
1 <!DOCTYPE HTML> 2 <html><head> 3 <title>Test for bug 456244</title> 4 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 5 <script src="/tests/SimpleTest/SimpleTest.js"></script> 6 <script src="/tests/SimpleTest/EventUtils.js"></script> 7 8 <script class="testbody" type="application/javascript"> 9 function runTest() { 10 function select(id) { 11 var e = document.getElementById(id); 12 e.focus(); 13 return e; 14 } 15 16 function setupIframe(id) { 17 var e = document.getElementById(id); 18 var doc = e.contentDocument; 19 doc.body.innerHTML = String.fromCharCode(10) + '<span id="' + id + '_span" style="border:1px solid blue" contenteditable="true">X</span>' + String.fromCharCode(10); 20 e = doc.getElementById(id + "_span"); 21 e.focus(); 22 return e; 23 } 24 25 function test_end_bs(e) { 26 const msg = "Deleting all text in contenteditable inline element"; 27 var before = e.parentNode.childNodes[0].nodeValue; 28 sendKey("right"); 29 sendKey("back_space"); 30 sendKey("back_space"); 31 is(e.parentNode.childNodes[0].nodeValue, before, msg + " with id=" + e.id); 32 is(e.innerHTML, "", msg + " with id=" + e.id); 33 } 34 35 test_end_bs(select("t1")); 36 test_end_bs(setupIframe("i1", 0)); 37 38 { 39 const msg = "Deleting all text in contenteditable body element"; 40 var e = document.getElementById("i2"); 41 var doc = e.contentDocument; 42 doc.body.setAttribute("contenteditable", "true"); 43 doc.body.focus(); 44 sendKey("right"); 45 sendKey("back_space"); 46 is(doc.body.innerHTML, "<br>", msg + " with id=" + e.id); 47 } 48 49 SimpleTest.finish(); 50 } 51 52 SimpleTest.waitForExplicitFinish(); 53 addLoadEvent(runTest); 54 </script> 55 </head> 56 <body> 57 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=456244">Mozilla Bug 456244</a> 58 <p id="display"></p> 59 60 <pre id="test"> 61 </pre> 62 63 <div> <span id="t1" style="border:1px solid blue" contenteditable="true">X</span> Y</div> 64 65 <iframe id="i1" width="200" height="100" src="about:blank"></iframe><br> 66 <iframe id="i2" width="200" height="100" src="about:blank">X</iframe><br> 67 68 </body> 69 </html>