[whatwg] More HTML Editing Commands questions

Tim Down timdown at gmail.com
Mon May 16 03:59:23 PDT 2011


I have a couple of general questions about the HTML Editing Commands spec:

1) Will there be any provision for special handling of whitespace text
nodes? I notice that WebKit leaves them alone. For example, running
document.execCommand("bold", false, null) for the following HTML with
selection boundaries denoted by pipes:

<p>|One</p>
<p>Two|</p>

... in Chrome 10 you get

<p>|<b>One</b></p>
<p><b>Two|<b></p>

The whitespace between the <p> elements has been ignored. This also
leads to a bug, since it seems the check for whether the selection
content is already completely bold does take into account the
whitespace node and rerunning the command now has no effect. Opera
surrounds the whitespace node within a styling element, while Firefox
seems to have some voodoo magic to decide whether or not to surround a
whitespace node. In the simple case above, it leaves it alone so long
as I haven't previously manipulated the DOM manually with my own
script.

2) Will the spec specify what happens when executing commands on an
insertion point/caret?

Tim


More information about the whatwg mailing list