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

Aryeh Gregor Simetrical+w3c at gmail.com
Sun Mar 13 13:46:36 PDT 2011


I did some research, looking at three different rich editing suites:
vBulletin's WYSIWYG editor, jwysiwyg (a jQuery plugin), and TinyMCE
(used by Wordpress).  I also looked at CKEditor, but I don't think it
uses execCommand() at all.  My full notes are at
<http://aryeh.name/spec/editcommands/notes.txt>.  One thing I found is
that all three set styleWithCSS to false.  This reinforces my theory
that styleWithCSS = true is not useful (although I'm still open to
counterexamples).

I've already gotten a bunch of WebKit feedback, so I'd appreciate
feedback from Mozilla and Opera.  (And Microsoft, if anyone can tell
me how to get feedback from them.)  Particular questions I'm currently
not so sure about:

1) Is there any reason to keep styleWithCSS/useCSS in its current
form?  Only Gecko and WebKit support it.  Trident and Presto only
support the equivalent of styleWithCSS = false, and the three rich
editors I studied force styleWithCSS to false unconditionally.  I can
see the value in a mode that doesn't produce invalid markup like
<font>, but is there any reason to have a mode that produces markup
like <span style="font-weight: bold"> instead of <b>?

2) How much work should we go to to produce nice-looking markup?
E.g., if the user unbolds "baz" in

<div style="font-weight:bold">
<p>Foo
<p>Bar baz
</div>

should we produce something like

<div>
<p style="font-weight: bold">Foo
<p><b>Bar </b>baz
</div>

like WebKit does, or would it be okay to do

<div style="font-weight:bold">
<p>Foo
<p>Bar <span style="font-weight: normal">baz</span>
</div>

to avoid the complexity, given that this sort of markup shouldn't be
too common?  I think it's clear that something like "<b>Foo baz
bar</b>" should become "<b>Foo </b>baz<b> bar</b>" and not "<b>Foo
<span style='font-weight: normal'>baz</span> bar</b>", but how far
should we go?


More information about the whatwg mailing list