test_bug622371.html (1426B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=622371 5 --> 6 <head> 7 <title>Test for Bug 622371</title> 8 <script src="/tests/SimpleTest/SimpleTest.js"></script> 9 <script src="/tests/SimpleTest/EventUtils.js"></script> 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=622371">Mozilla Bug 622371</a> 14 <p id="display"></p> 15 <div id="content"> 16 <iframe srcdoc="<body contenteditable>abc</body>"></iframe> 17 </div> 18 <pre id="test"> 19 <script type="application/javascript"> 20 21 /** Test for Bug 622371 */ 22 // This test is ported to WPT: 23 // html/editing/editing-0/contenteditable/selection-in-contentEditable-at-turning-designMode-on-off.tentative.html 24 // But unfortunately, the random orange reported as bug 1601585 with it. 25 // Therefore, this test is not removed. 26 SimpleTest.waitForExplicitFinish(); 27 addLoadEvent(function() { 28 var i = document.querySelector("iframe"); 29 var sel = i.contentWindow.getSelection(); 30 var doc = i.contentDocument; 31 var body = doc.body; 32 i.focus(); 33 sel.collapse(body, 1); 34 doc.designMode = "on"; 35 doc.designMode = "off"; 36 is(sel.getRangeAt(0).startOffset, 1, "The start offset of the selection shouldn't change"); 37 is(sel.getRangeAt(0).endOffset, 1, "The end offset of the selection shouldn't change"); 38 SimpleTest.finish(); 39 }); 40 41 </script> 42 </pre> 43 </body> 44 </html>