[whatwg] Ongoing work on an editing commands (execCommand()) specification

Tim Down timdown at gmail.com
Fri Mar 18 02:45:04 PDT 2011


On 18 March 2011 00:43, Aryeh Gregor <Simetrical+w3c at gmail.com> wrote:
> On Thu, Mar 17, 2011 at 6:45 PM, Tim Down <timdown at gmail.com> wrote:
>> I'm interested in this stuff and am very grateful for your work. I've
>> been writing a document.execCommand() replacement for my Rangy library
>> (http://code.google.com/p/rangy/), so this is all extremely relevant
>> for me.
>
> In the course of writing the spec, I'm also writing an implementation
> in JavaScript to make sure it's sane and produces expected results.
> I'm not making any effort to have it work in browsers other than the
> most recent -- getting it to work in IE < 9 might be a significant
> hassle -- but in a few months it should be a quite complete
> execCommand() implementation, maybe suitable for use in a JavaScript
> library if someone wants to make it work in old browsers.
>
> I'm doing something similar for the DOM Range tests I'm writing.  For
> instance, I've written JavaScript implementations of deleteContents(),
> cloneContents(), and extractContents() to match my spec text, which in
> turn closely matches browsers.  You can take a look here:
>
> https://bitbucket.org/ms2ger/dom-range/src/tip/test/
>
> If you're writing your library based on the W3C's DOM Level 2 Range
> spec, you might not want to.  The DOM Range spec at html5.org might be
> a better reference, if it defines the functionality you're looking
> for:
>
> http://html5.org/specs/dom-range.html
>
> It should be much easier to implement, since it's written
> algorithmically in the style of HTML5 (my implementations just follow
> the spec line-by-line).  It also has more features and more closely
> matches how browsers actually work, and it defines Selection too.
>
> All of my spec-related code (tests, implementations, etc.) is in the
> public domain.

The core stuff for my library (DOM Range and Selection for all
browsers, including IE < 9) is already done. The Range part follows
the DOM Level 2 Range spec (apart from the parts about the effect of
DOM mutation on existing Ranges, which I didn't implement), since your
new algorithm-based spec didn't exist at the time (August-October
2010). The Selection part imitates what I considered the most useful
common ground between Mozilla and WebKit Selection objects with only a
little influence from the Selection section in the HTML5 spec (which
is where it was at the time) since it had a number of issues that I
discovered and raised bugs for while writing the selection code
(backwards selections, extend(), toString()).

I have been following your progress fairly carefully and am aware of
the extra features in your spec, some of which may have originated
from my requests. There is a lot of useful stuff in your code, spec
and tests that I intend to look at to verify and likely improve my
code. Thanks for all your work.

Tim

Tim


More information about the whatwg mailing list