[whatwg] Normalization of user selections

On Fri, Jun 17, 2011 at 4:33 AM, Ojan Vafai <ojan at chromium.org> wrote:

> On Thu, Jun 16, 2011 at 12:09 PM, Ryosuke Niwa <rniwa at webkit.org> wrote:
>
> > Yes, I think all selection modified by user should be normalized by
> > default.
> >  I'm talking more about programmatically set selection.  I think we'll
> need
> > to preserve programmatically set selection ranges instead of always
> storing
> > normalized ranges.
> >
>
> I disagree. That defeats all the benefits of normalizing. Now all the code
> that handles editing can't assume normalization.
>

FWIW, I'm with Ryosuke on this one - NOT preserving programmatically set
selections seems very dangerous to me, esp. if it's just for the sake of
making it easier on the implementors. That way, neither the user NOR the
programmer has complete control over what is happening in detail.

On Fri, Jun 17, 2011 at 4:38 AM, Boris Zbarsky <bzbarsky at mit.edu> wrote:

> Indeed.
>
> And the fact that the two DOM positions correspond to the same user-visible
> selection is not set in stone either.  Perhaps the real answer is to use
> such directional hints and make it clear to the user somehow where the
> insertion point really is?  The latter is what's hard in a wysiwyg context.
>

Exactly my thoughts. It's unfortunate that whether 2 different positions in
the DOM correspond to the same visual position cannot be determined by
looking at the DOM only - for example, there may be margins or even
auto-generated content around elements, that *do* neatly separate them.


- Roland

Received on Friday, 17 June 2011 01:01:06 UTC