2 <html class=
"reftest-wait">
4 <script src=
"/tests/SimpleTest/EventUtils.js"></script>
6 <body onload=
"doTest()">
7 <input type=text
style=
"-moz-appearance: none">
10 function enableCaret(aEnable
) {
11 var selCon
= editor
.selectionController
;
12 selCon
.setCaretEnabled(aEnable
);
15 var d
= document
.querySelector("input");
18 var editor
= SpecialPowers
.wrap(d
).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");