[webkit-dev] programmatic text selection

Giacomo Luca Maioli luca at tricheco.net
Fri May 26 14:37:19 PDT 2006


Il giorno 26/mag/06, alle ore 23:12, Sam Gendler ha scritto:

> Thanks Giacomo - I think your original example had a typo (the 1 as a
> last parameter), as the page you provided works great (a 0 as the last
> parameter).
>
> One question - how does one select a node which has no sibling?
> Putting the same node as both node parameters to setBaseAndExtent has
> no effect.
>
> --sam
>

Putting the same node with different offset works for me (this works  
in setBaseAndExtent but not with the range object in mozilla) if I  
use different (incremental) offset values.
For example:

 >>  window.getSelection().setBaseAndExtent(selDiv, 0, selDiv, 1);		// 
Same node, different offsets.

Gives the same result as the published example.





More information about the webkit-dev mailing list