W3C home > Mailing lists > Public > whatwg@whatwg.org > March 2011

[whatwg] selection.modify behavior across platforms

From: Ehsan Akhgari <ehsan@mozilla.com>
Date: Sat, 26 Mar 2011 09:38:25 -0700 (PDT)
Message-ID: <1212188637.64038.1301157505101.JavaMail.root@cm-mail03.mozilla.org>
> 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
http://ehsanakhgari.org/
Received on Saturday, 26 March 2011 09:38:25 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:31 UTC