26 May
2006
26 May
'06
8:40 p.m.
On 5/26/06, Giacomo Luca Maioli <luca@tricheco.net> wrote:
But Safari throws an error while processing the last method (the one which actually highlight text), so you should try:
window.getSelection().setBaseAndExtent(selDiv, 0, selDiv, 1);
So you'll only need to play around with this (strange and mostly unknown) method.
I'm afraid Safari doesn't appear to support setBaseAndExtent() method on a selection, either.
I just tested the code on both Firefox and Safari. You can find a working example here: http://www.tricheco.net/selection.html I'm using Safari Version 2.0.3 (417.9.3) and Firefox 1.5.0.3 on Mac and Windows.