--- a/editcommands.html Sun May 29 15:38:39 2011 -0600
+++ b/editcommands.html Sun May 29 15:38:52 2011 -0600
@@ -689,6 +689,13 @@
<li>If <var title="">node list</var> is empty, or the first member of <var title="">node
list</var> is not <a href=#editable>editable</a>, return null and abort these steps.
+ <li>If <var title="">node list</var>'s last member is an <a href=#inline-node>inline node</a>
+ that's not a <code class=external data-anolis-spec=html title="the br element"><a href=http://www.whatwg.org/html/#the-br-element>br</a></code>, and <var title="">node list</var>'s last member's <code class=external data-anolis-spec=domcore title=dom-Node-nextSibling><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#dom-node-nextsibling>nextSibling</a></code>
+ is a <code class=external data-anolis-spec=html title="the br element"><a href=http://www.whatwg.org/html/#the-br-element>br</a></code>, append that <code class=external data-anolis-spec=html title="the br element"><a href=http://www.whatwg.org/html/#the-br-element>br</a></code> to <var title="">node list</var>.
+ <!-- Trailing br's like this always need to go along with their line.
+ Otherwise they'll create an extra line if we wrap in a block element, instead
+ of vanishing as they should. -->
+
<li>If the <code class=external data-anolis-spec=domcore title=dom-Node-previousSibling><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#dom-node-previoussibling>previousSibling</a></code> of the first member of <var title="">node list</var>
is <a href=#editable>editable</a> and meets the <a href=#sibling-criteria>sibling criteria</a>, let
<var title="">new parent</var> be the <code class=external data-anolis-spec=domcore title=dom-Node-previousSibling><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#dom-node-previoussibling>previousSibling</a></code> of the first member of
--- a/implementation.js Sun May 29 15:38:39 2011 -0600
+++ b/implementation.js Sun May 29 15:38:52 2011 -0600
@@ -563,6 +563,14 @@
return null;
}
+ // "If node list's last member is an inline node that's not a br, and node
+ // list's last member's nextSibling is a br, append that br to node list."
+ if (isInlineNode(nodeList[nodeList.length - 1])
+ && !isHtmlElement(nodeList[nodeList.length - 1], "br")
+ && isHtmlElement(nodeList[nodeList.length - 1].nextSibling, "br")) {
+ nodeList.push(nodeList[nodeList.length - 1].nextSibling);
+ }
+
// "If the previousSibling of the first member of node list is editable and
// meets the sibling criteria, let new parent be the previousSibling of the
// first member of node list."
--- a/source.html Sun May 29 15:38:39 2011 -0600
+++ b/source.html Sun May 29 15:38:52 2011 -0600
@@ -647,6 +647,13 @@
<li>If <var>node list</var> is empty, or the first member of <var>node
list</var> is not <span>editable</span>, return null and abort these steps.
+ <li>If <var>node list</var>'s last member is an <span>inline node</span>
+ that's not a [[br]], and <var>node list</var>'s last member's [[nextsibling]]
+ is a [[br]], append that [[br]] to <var>node list</var>.
+ <!-- Trailing br's like this always need to go along with their line.
+ Otherwise they'll create an extra line if we wrap in a block element, instead
+ of vanishing as they should. -->
+
<li>If the [[previoussibling]] of the first member of <var>node list</var>
is <span>editable</span> and meets the <span>sibling criteria</span>, let
<var>new parent</var> be the [[previoussibling]] of the first member of