[kupu-dev] Questions on 'low-level' manipulation of elements of kupu.

Duncan Booth duncan.booth at suttoncourtenay.org.uk
Wed Jan 31 12:01:24 CET 2007


Kenneth McDonald <kenneth.m.mcdonald at sbcglobal.net> wrote:

> I don't really know how the cursor is implemented in editable
> documents; if it's a special-purpose construct built in at a
> low-level, or if it's a more general DOM construct. I'm hoping it's
> implemented as (in FF) a 'Range' object or something similar, but if
> it is, I can't figure out how to get access to it, nor can I figure
> out any simple way how a Range instance would be able determine its
> horizontal place so as to be able to correctly move up and down in the
> text, in response to keypresses. (I can think of some non-simple ways,
> but they all involve significant intermediate DOM manipulation, are
> pretty messy.) 
> 

In kupu call the getSelection() method on the editor object and it will
return you either a MozillaSelection or IESelection object. This will
allow you to manipulate the selection range in a not-so-browser-dependant
way.

Mapping the selection to the physical layout on the screen is not
really feasible though.



More information about the kupu-dev mailing list