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

Roland Steiner rolandsteiner at google.com
Tue Mar 1 20:39:13 PST 2011


Great that this is getting attention spec-wise!

First, could it be that the link you posted is broken (I get "404 - No such
project." when clicking on it)?

Also, reposting my initial comment I sent you, as you requested: In your
draft you write:

I'm not sure if my priorities in writing the algorithms here are correct. My
goals were 1) make the algorithms as simple as possible, and 2) minimize
surprising user-visible behavior (e.g., "I clicked B but it didn't turn
bold!"). I didn't try to optimize the niceness of the resulting DOM at all,
so for instance, when bolding abc <i>def</i> <br> ghi you get <b>abc </b><i
style="font-weight: bold">def</i><b> </b><br style="font-weight: bold"><b>
ghi</b> instead of wrapping the whole thing in a single <b>. This is to
avoid making the algorithm understand content models, but maybe it's worth
revisiting later. Likewise, unbolding the middle word of <b>Foo bar baz</b>
 produces <b>Foo <span style="font-weight: normal">bar</span> baz</b> instead
of the simpler <b>Foo </b>bar<b> baz</b>. For now, the algorithm works, even
if it produces messy DOMs.


In general, I completely agree on 2), but I think there are several issues
with 1) and the "messy DOM" part:

.) If you produce messy DOMs, the DOM will get ever more messy the more the
user edits stuff. IMHO producing nicer DOMs is more important than simple
algorithms. Also, the messier the DOM, the harder it is for editors to cope
with it. FWIW, for the new Browserscope RichText test suite I took the
opposite stance: that the resulting DOM should be as concise as possible.

.) In your results you mix element-based styling and CSS-based styling. I
don't think that's a good idea, for 2 reasons (apart from looking
inconsistent): 1.) you force complexity on code that perhaps could live with
just simple element-based markup  2.) whether to produce element-based
styling or CSS-based styling should be determined by whether or not
"StyleWithCSS" was set. (Now, I'm not a huge fan of that command, but I do
think it's important for users to have a way to specify this).

Cheers,

- Roland

On Wed, Mar 2, 2011 at 3:36 AM, Aryeh Gregor <Simetrical+w3c at gmail.com>wrote:

> Two or three weeks ago I began writing a specification for
> execCommand() and related functions.  I don't have anything
> implementable yet -- it's very incomplete and there are known issues
> with the existing stuff.  But I thought I'd post it for any early
> review comments on the direction I'm taking, particularly from
> implementers but also from anyone else familiar with the APIs (e.g.,
> someone who's used them in practice):
>
>
> http://aryeh.name/gitweb.cgi?p=editcommands;a=blob_plain;f=editcommands.html;hb=HEAD
>
> The plan is that this should be merged into the main HTML spec, with a
> full test suite, by the end of August.  Feedback appreciated.
>



More information about the whatwg mailing list