gecko/layout/base/tests/bug585922.html
Bobby Holley 5af5a73d3d Bug 792036 - Automated fixups. r=mccr8
find /files/mozilla/build/d/_tests/testing/mochitest/tests/ | egrep "\.(xhtml|html|xml|js)$" | grep -v SimpleTest | grep -vi mochikit | grep -v simpleThread | grep -v test_ipc_messagemanager_blob.html | grep -v "indexedDB/test" | xargs grep -l Components |  xargs grep -L enablePrivilege | perl -pe 's#.*mochitest/tests/##' | xargs perl -p -i.bakkk -e 's/Components\.interfaces(\s|;|\.|\[)/SpecialPowers\.Ci$1/g, s/SpecialPowers\.wrap\(Components\)\.(.)(lasses|tils|nterfaces|esults)/SpecialPowers.C$1/g, s/(?<![\.a-zA-Z])Components/SpecialPowers\.Components/g, s/window\.Components/window\.SpecialPowers\.Components/g'
2012-09-24 14:46:29 +02:00

36 lines
1.3 KiB
HTML

<!DOCTYPE html>
<html class="reftest-wait">
<head>
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
</head>
<body onload="doTest()">
<input type=text>
<script>
function doTest() {
function enableCaret(aEnable) {
var selCon = editor.selectionController;
selCon.setCaretEnabled(aEnable);
}
var d = document.querySelector("input");
d.value = "a";
d.focus();
var editor = SpecialPowers.wrap(d).QueryInterface(SpecialPowers.Ci.nsIDOMNSEditableElement).editor;
var sel = editor.selection;
var t = editor.rootElement.firstChild;
sel.collapse(t, 1); // put the caret at the end of the div
setTimeout(function() {
enableCaret(false);enableCaret(true);// force a caret display
enableCaret(false); // hide the caret
t.replaceData(0, 1, "b"); // replace the text node data
// at this point, the selection is collapsed to offset 0
synthesizeQuerySelectedText(); // call nsCaret::GetGeometry
sel.collapse(t, 1); // put the caret at the end again
enableCaret(true); // show the caret again
document.documentElement.removeAttribute("class");
}, 0);
}
</script>
</body>
</html>