[whatwg] selection.modify behavior across platforms

Ryosuke Niwa rniwa at webkit.org
Fri Mar 25 23:51:50 PDT 2011


On Fri, Mar 25, 2011 at 10:46 PM, Ehsan Akhgari <ehsan at mozilla.com> wrote:
>
> But with the behavior of the API changing based on the platform, the author
> can either choose to sniff the UA string, or check what the API did after
> calling it.  The scarier scenario is the author testing their application on
> one platform, and deploying it without realizing that it will break in other
> platforms.
>

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.

I think if we want to have the platform specific word selection capability
> in the API, we should have a different granularity value which points out
> that its results are platform specific.  Otherwise, it's just too easy to
> assume that the result of calling this API is

the same across all platforms, just like almost all other Web APIs.
>

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.

- Ryosuke



More information about the whatwg mailing list