layout/base/tests/bug585922.html

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 <!DOCTYPE html>
     2 <html class="reftest-wait">
     3   <head>
     4     <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
     5   </head>
     6   <body onload="doTest()">
     7     <input type=text style="-moz-appearance: none">
     8     <script>
     9       function doTest() {
    10         function enableCaret(aEnable) {
    11           var selCon = editor.selectionController;
    12           selCon.setCaretEnabled(aEnable);
    13         }
    15         var d = document.querySelector("input");
    16         d.value = "a";
    17         d.focus();
    18         var editor = SpecialPowers.wrap(d).QueryInterface(SpecialPowers.Ci.nsIDOMNSEditableElement).editor;
    19         var sel = editor.selection;
    20         var t = editor.rootElement.firstChild;
    21         sel.collapse(t, 1); // put the caret at the end of the div
    22         setTimeout(function() {
    23           enableCaret(false);enableCaret(true);// force a caret display
    24           enableCaret(false); // hide the caret
    25           t.replaceData(0, 1, "b"); // replace the text node data
    26           // at this point, the selection is collapsed to offset 0
    27           synthesizeQuerySelectedText(); // call nsCaret::GetGeometry
    28           sel.collapse(t, 1); // put the caret at the end again
    29           enableCaret(true); // show the caret again
    30           document.documentElement.removeAttribute("class");
    31         }, 0);
    32       }
    33     </script>
    34   </body>
    35 </html>

mercurial