[Webkit-unassigned] [Bug 22025] range.deleteContents() does not collapse the selection

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Mar 17 10:11:32 PDT 2009


https://bugs.webkit.org/show_bug.cgi?id=22025





------- Comment #8 from jparent at google.com  2009-03-17 10:11 PDT -------
Are you still looking for a solution to any of these problems?  As Eric said,
getRangeAt(0) provides you a temporary range to work with, if you would like
the selection the user sees to become that range, you'll just to need to set
it.

So, instead of:
window.getSelection().getRangeAt().collapse(true), 
use:
var sel = window.getSelection();
var range = sel.getRangeAt(0);
range.collapse(true);
sel.removeAllRanges();
sel.addRange(range);

Instead of:
window.getSelection().getRangeAt(0).setEnd(mybody, 0);
window.getSelection().getRangeAt(0).setStart(mybody, 0);
use:
window.getSelection().setBaseAndExtent(myBody, 0, myBody, 0);


-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the webkit-unassigned mailing list