[Mozile] RE: 0.8: nesting contentEditable = "false"

James A. Overton james at overton.ca
Thu Jun 8 12:12:42 EDT 2006


On 2006-Jun-08, at 10:45 AM, Short, Tom wrote:

> This is probably a dumb question, but is it possible to generate  
> our own
> blinking caret? It can even be the old-style Emacs like block  
> cursor. If
> we can get the currently selected character, couldn't we just keep
> swapping the foreground and background colors once or twice a second?
>
> - Tom
>

Yes, we could insert an element at the insertion point and make it  
look like a cursor (using CSS or whatever). It would break up text  
nodes that shouldn't be broken, and for that reason it would require  
a complicated rewrite of most of editing code. We'd have write new  
code to wrap the browser's Selection object, too. But it could be done.
	An even bigger problem comes with ranges. The same method to select  
a range of text would require us to insert a span element styled with  
a different background colour. It would have to cut across block  
level elements or use multiple span elements, and it would make a  
complete mess of the document. If we relied on the browser's normal  
selection object, then we'd have to allow for two cases: normal  
selection and the custom cursor.
	I've considered the idea before, but I haven't come up with a way  
around these problems. Unless someone has a solution, I think it's  
best to rely on the browser's Selection object as much as we can,  
even if that has some annoyances.

James


More information about the Mozile mailing list