function test()
{ var selection = window.getSelection();
selection.removeAllRanges(); var rect = div1.getBoundingClientRect();
// Position the caret using a fake mouse click var Ci = SpecialPowers.Ci; var cwu = SpecialPowers.getDOMWindowUtils(window);
cwu.sendMouseEventToWindow("mousedown", rect.left + rect.width/2, rect.top + rect.height/2, 0, 0, 0, true);
cwu.sendMouseEventToWindow("mouseup", rect.left + rect.width/2, rect.top + rect.height/2, 0, 0, 0, true); var selectionController = SpecialPowers.wrap(window).docShell.
QueryInterface(Ci.nsIInterfaceRequestor).
getInterface(Ci.nsISelectionDisplay).
QueryInterface(Ci.nsISelectionController);
selectionController.wordMove(false, false);
selectionController.wordMove(true, true);
isnot(selection.rangeCount, 0, "Something should be selected"); var string = selection.toString();
sendTouch("touchstart", rect.right, rect.top + rect.height/2);
sendTouch("touchmove", rect.left, rect.top + rect.height/2);
sendTouch("touchend", rect.left, rect.top + rect.height/2);
is(selection.toString(), string, "touch events should not affect the selection");
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.