Advertisement
Guest User

Untitled

a guest
May 3rd, 2016
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE HTML><html>
  2. <!--
  3. https://bugzilla.mozilla.org/show_bug.cgi?id=1263288
  4. -->
  5. <head>
  6.     <meta charset="utf-8">
  7.     <title>Testcase #1 for bug 1263288</title>
  8.     <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
  9.     <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
  10.     <script src="selection-utils.js"></script>
  11. </head>
  12. <body onload="start()">
  13. <div id="readonly">xyz</div>
  14. <div id="editable" contenteditable='true' style="outline: none;"><span contentEditable='false'>xyz<!-- comment --></span><br></br></div>
  15. <script>
  16.  
  17. // Work around a bug where synthesizeKey with VK_END doesn't work on Linux and Mac.
  18. function moveToEndOfLine(sel) {
  19.   if (navigator.platform.indexOf("Win") == 0) {
  20.     synthesizeKey("VK_END", {});
  21.   } else {
  22.     // End key doesn't work as expected on Mac and Linux.
  23.     sel.modify("move", "right", "lineboundary");
  24.   }
  25. }
  26.  
  27. function start() {
  28.     var sel = window.getSelection();
  29.     // Focus on editable block.
  30.     theDiv = document.getElementById("editable");
  31.     theDiv.focus();
  32.     sel.collapse(theDiv, 0);
  33.     synthesizeMouse(theDiv, 100, 2, {});
  34.     moveToEndOfLine(sel);
  35. }
  36.  
  37. </script>
  38. </body>
  39. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement