[whatwg] selection.modify behavior across platforms

Ehsan Akhgari ehsan at mozilla.com
Sat Mar 26 09:38:25 PDT 2011

> I'm not sure why we need to provide a consistent behavior all
> platforms. I think the whole point of modify() function is so that
> scripts can emulate selection operations user can initiate. Imagine an
> app that intercepts user actions such as key down and manually sets
> selection using modify() because it needs to update some internal
> state, etc... in such applications, it's extremely desirable that the
> result of modify() to match what user does.

Well, it depends on what you want to do.  If you want to implement the spell correction UI I talked about before, for example, you really want to ask the browser to give you the boundaries of the word, not including any word separators.  Right?

> Our implementation of modify() is already platform-specific in many
> ways. I personally don't see a point in making this specific case
> platform-independent.

If I'm not mistaken, Webkit already implements this in a platform-independent way (at least Chrome does) as far as the user of the API is concerned.

The thing that bothers me about making the behavior platform-dependent is that almost all other web APIs are agnostic to the underlying platform, which makes web authors automatically expect that from all APIs, which may cause unexpected surprises if the author doesn't test their application in all platforms.  Don't you think that is a problem which we should address somehow?

Ehsan Akhgari
ehsan at mozilla.com

More information about the whatwg mailing list