[whatwg] selection.modify behavior across platforms
Ehsan Akhgari
ehsan at mozilla.com
Wed Mar 23 21:31:55 PDT 2011
Hi all,
Usually, when the user is using the keyboard to extend or move the
selection in a document, the result of the keyboard commands vary
depending on the underlying platform.
For example, on Windows, word selection "eats spaces" in between words.
That is, if you have "f|oo bar" (the pipe donating the current
selection caret) and use the keyboard shortcut to go to the next word,
you'll end up before bar: "foo |bar". However, on Linux and OS X, under
the same circumstances, you'll end up right after foo: "foo| bar".
If we incorporate this behavior into selection.modify, its behavior can
be different depending on the platform the UA is rendering the web page
on (if using the "word" granularity, of course).
This is what Gecko does in Firefox 4. Webkit, however, implements the
"non-space-eating" approach on all platforms. I think this is an
advantage, because it means that the consumers of the API can rely on
the behavior of the API without having to resort to User-Agent sniffing.
So, I modified the behavior of Gecko today[1] to match that of Webkit
(i.e., not eating spaces between words).
I wanted to see what others think about this issue. Feedback is most
welcome.
Cheers,
Ehsan
[1] https://bugzilla.mozilla.org/show_bug.cgi?id=642823
More information about the whatwg
mailing list