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

Aryeh Gregor Simetrical+w3c at gmail.com
Thu Mar 17 17:43:27 PDT 2011

On Thu, Mar 17, 2011 at 6:45 PM, Tim Down <timdown at gmail.com> wrote:
> Is a column full of
> "Exception: [Exception... "Not enough arguments" nsresult: "0x80570001
> (NS_ERROR_XPC_NOT_ENOUGH_ARGS)" location: "JS frame ::
> http://aryeh.name/spec/editcommands/implementation.js :: getState ::
> line 1046" data: no]"
> the expected result in Firefox 3.6.15?

No, but it doesn't matter to me.  I only test in the latest versions
of every browser, since earlier versions are mostly irrelevant to
standards work.

> 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:


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


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.

More information about the whatwg mailing list