Which is . . . nothing. Invoking bold (for instance) when the selection
doesn't contain anything just does nothing. I expected it to insert an
empty <b></b> with the cursor inside so that if you start typing it's
bold. But apparently, that doesn't happen. So do editors have to fake
up that effect themselves, or am I missing something? Puzzling.

--- a/editcommands.html Wed Apr 13 10:28:40 2011 -0600+++ b/editcommands.html Wed Apr 13 10:53:15 2011 -0600@@ -152,11 +152,6 @@ don't want to have to explicitly refer to DOM methods like insertBefore() every time I want to move things.- <li>I haven't put any thought yet into collapsed ranges or selections.- Currently my algorithms mostly do nothing if the selection is collapsed,- which is of course wrong. E.g., bold with collapsed selection should put- &lt;b&gt;&lt;/b&gt; at the cursor, generally.- <li>Some more thought needs to go into what happens to the selection when you mutate the DOM. In some cases the results are pretty arbitrary. It might make sense to do some kind of normalization.@@ -1267,6 +1262,11 @@ <dt><code title=""><dfn id=command-bold title=command-bold>bold</dfn></code>+<!-- If the selection is collapsed (but not if it contains nothing but is not+collapsed), IE9 wraps the whole line in a <strong>. This seems bizarre and no+one else does it, so I don't do it. It's a similar story for similar commands+(fontName, italic, etc.). Except not for strikethrough, where it just does+nothing if the selection is empty. Why strikethrough? I don't know. --> <dd><strong>Action</strong>: <a href=#decompose>Decompose</a> the <a class=external data-anolis-spec=domrange href=http://html5.org/specs/dom-range.html#concept-range title=concept-range>range</a>. If the state of the <a class=external data-anolis-spec=domrange href=http://html5.org/specs/dom-range.html#concept-range title=concept-range>range</a> for this command is then true, <a href=#set-the-value>set the@@ -1297,6 +1297,10 @@ <dt><code title=""><dfn id=command-createlink title=command-createlink>createLink</dfn></code> <dd><strong>Action</strong>: The user agent must run the following steps:+<!-- If the selection doesn't contain anything (meaning, e.g., deleteContents()+doesn't change anything), then Chrome 12 dev inserts a link at the selection+start, with the text equal to the link URL. Other browsers don't do it, so I+don't either. --> <ol> <li>If <var title="">value</var> is the empty string, abort these steps and do

--- a/source.html Wed Apr 13 10:28:40 2011 -0600+++ b/source.html Wed Apr 13 10:53:15 2011 -0600@@ -139,11 +139,6 @@ don't want to have to explicitly refer to DOM methods like insertBefore() every time I want to move things.- <li>I haven't put any thought yet into collapsed ranges or selections.- Currently my algorithms mostly do nothing if the selection is collapsed,- which is of course wrong. E.g., bold with collapsed selection should put- &lt;b>&lt;/b> at the cursor, generally.- <li>Some more thought needs to go into what happens to the selection when you mutate the DOM. In some cases the results are pretty arbitrary. It might make sense to do some kind of normalization.@@ -1280,6 +1275,11 @@ <dt><code title><dfn title=command-bold>bold</dfn></code>+<!-- If the selection is collapsed (but not if it contains nothing but is not+collapsed), IE9 wraps the whole line in a <strong>. This seems bizarre and no+one else does it, so I don't do it. It's a similar story for similar commands+(fontName, italic, etc.). Except not for strikethrough, where it just does+nothing if the selection is empty. Why strikethrough? I don't know. --> <dd><strong>Action</strong>: <span>Decompose</span> the [[range]]. If the state of the [[range]] for this command is then true, <span>set the@@ -1310,6 +1310,10 @@ <dt><code title><dfn title=command-createlink>createLink</dfn></code> <dd><strong>Action</strong>: The user agent must run the following steps:+<!-- If the selection doesn't contain anything (meaning, e.g., deleteContents()+doesn't change anything), then Chrome 12 dev inserts a link at the selection+start, with the text equal to the link URL. Other browsers don't do it, so I+don't either. --> <ol> <li>If <var>value</var> is the empty string, abort these steps and do