--- a/editcommands.html Tue Jun 07 14:41:16 2011 -0600
+++ b/editcommands.html Tue Jun 07 15:01:02 2011 -0600
@@ -750,12 +750,11 @@
<a href=#preserving-ranges>preserving ranges</a>.
</ol>
- <li>If the first member of <var title="">node list</var> and 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 <var title="">original parent</var> are both <a href=#inline-node title="inline node">inline
- nodes</a>, call <code class=external data-anolis-spec=domcore title=dom-Document-createElement><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#dom-document-createelement>createElement("br")</a></code> on the
- <code class=external data-anolis-spec=domcore title=dom-Node-ownerDocument><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#dom-node-ownerdocument>ownerDocument</a></code> of <var title="">original parent</var>, then insert the result into
- the <a class=external data-anolis-spec=domcore href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-tree-parent title=concept-tree-parent>parent</a> of <var title="">original parent</var> immediately before <var title="">original
- parent</var>.
+ <li>If the first member of <var title="">node list</var> is an <a href=#inline-node>inline
+ node</a>, and <var title="">original parent</var>'s <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> is an
+ <a href=#inline-node>inline node</a> other than 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>, call <code class=external data-anolis-spec=domcore title=dom-Document-createElement><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#dom-document-createelement>createElement("br")</a></code> on
+ the <a class=external data-anolis-spec=domrange href=http://html5.org/specs/dom-range.html#context-object>context object</a>, then insert the result into the <a class=external data-anolis-spec=domcore href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-tree-parent title=concept-tree-parent>parent</a> of
+ <var title="">original parent</var> immediately before <var title="">original parent</var>.
<li>For each <var title="">node</var> in <var title="">node list</var>, insert <var title="">node</var>
into the <a class=external data-anolis-spec=domcore href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-tree-parent title=concept-tree-parent>parent</a> of <var title="">original parent</var> immediately before
@@ -1298,9 +1297,8 @@
<li>While <var title="">children</var>'s first member's <a class=external data-anolis-spec=domcore href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-tree-parent title=concept-tree-parent>parent</a> is not <var title="">start
block</var>, <a href=#split-the-parent>split the parent</a> of <var title="">children</var>.
- <li>If the <a class=external data-anolis-spec=domcore href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-tree-child title=concept-tree-child>child</a> of <var title="">range</var>'s <a class=external data-anolis-spec=domrange href=http://html5.org/specs/dom-range.html#concept-range-start title=concept-range-start>start</a> <a class=external data-anolis-spec=domrange href=http://html5.org/specs/dom-range.html#concept-boundary-point-node title=concept-boundary-point-node>node</a> with <a class=external data-anolis-spec=domrange href=http://html5.org/specs/dom-range.html#concept-indexof title=concept-indexof>index</a>
- equal to its <a class=external data-anolis-spec=domrange href=http://html5.org/specs/dom-range.html#concept-range-start title=concept-range-start>start</a> <a class=external data-anolis-spec=domrange href=http://html5.org/specs/dom-range.html#concept-boundary-point-offset title=concept-boundary-point-offset>offset</a> 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> and is not the first member of
- <var title="">children</var>, remove 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> from its <a class=external data-anolis-spec=domcore href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-tree-parent title=concept-tree-parent>parent</a>.
+ <li>If <var title="">children</var>'s first member's <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> is an
+ <a href=#editable>editable</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>, remove 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> from its <a class=external data-anolis-spec=domcore href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-tree-parent title=concept-tree-parent>parent</a>.
</ol>
<li>Otherwise, if <var title="">start block</var> is a <a class=external data-anolis-spec=domcore href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-tree-descendant title=concept-tree-descendant>descendant</a> of <var title="">end
--- a/implementation.js Tue Jun 07 14:41:16 2011 -0600
+++ b/implementation.js Tue Jun 07 15:01:02 2011 -0600
@@ -566,13 +566,14 @@
}
}
- // "If the first member of node list and the previousSibling of original
- // parent are both inline nodes, call createElement("br") on the
- // ownerDocument of original parent, then insert the result into the parent
- // of original parent immediately before original parent."
+ // "If the first member of node list is an inline node, and original
+ // parent's previousSibling is an inline node other than a br, call
+ // createElement("br") on the context object, then insert the result into
+ // the parent of original parent immediately before original parent."
if (isInlineNode(nodeList[0])
- && isInlineNode(originalParent.previousSibling)) {
- originalParent.parentNode.insertBefore(originalParent.ownerDocument.createElement("br"), originalParent);
+ && isInlineNode(originalParent.previousSibling)
+ && !isHtmlElement(originalParent.previousSibling, "br")) {
+ originalParent.parentNode.insertBefore(document.createElement("br"), originalParent);
}
// "For each node in node list, insert node into the parent of original
@@ -1111,12 +1112,11 @@
splitParent(children);
}
- // "If the child of range's start node with index equal to its start
- // offset is a br and is not the first member of children, remove that
- // br from its parent."
- if (isHtmlElement(range.startContainer.childNodes[range.startOffset], "br")
- && range.startContainer.childNodes[range.startOffset] != children[0]) {
- range.startContainer.removeChild(range.startContainer.childNodes[range.startOffset]);
+ // "If children's first member's previousSibling is an editable br,
+ // remove that br from its parent."
+ if (isEditable(children[0].previousSibling)
+ && isHtmlElement(children[0].previousSibling, "br")) {
+ children[0].parentNode.removeChild(children[0].previousSibling);
}
// "Otherwise, if start block is a descendant of end block:"
--- a/source.html Tue Jun 07 14:41:16 2011 -0600
+++ b/source.html Tue Jun 07 15:01:02 2011 -0600
@@ -700,13 +700,11 @@
<span>preserving ranges</span>.
</ol>
- <li>If the first member of <var>node list</var> and the [[previoussibling]]
- of <var>original parent</var> are both <span title="inline node">inline
- nodes</span>, call <code data-anolis-spec=domcore
- title=dom-Document-createElement>createElement("br")</code> on the
- [[ownerdocument]] of <var>original parent</var>, then insert the result into
- the [[parent]] of <var>original parent</var> immediately before <var>original
- parent</var>.
+ <li>If the first member of <var>node list</var> is an <span>inline
+ node</span>, and <var>original parent</var>'s [[previoussibling]] is an
+ <span>inline node</span> other than a [[br]], call [[createelement|"br"]] on
+ the [[contextobject]], then insert the result into the [[parent]] of
+ <var>original parent</var> immediately before <var>original parent</var>.
<li>For each <var>node</var> in <var>node list</var>, insert <var>node</var>
into the [[parent]] of <var>original parent</var> immediately before
@@ -1255,9 +1253,8 @@
<li>While <var>children</var>'s first member's [[parent]] is not <var>start
block</var>, <span>split the parent</span> of <var>children</var>.
- <li>If the [[child]] of <var>range</var>'s [[startnode]] with [[index]]
- equal to its [[startoffset]] is a [[br]] and is not the first member of
- <var>children</var>, remove that [[br]] from its [[parent]].
+ <li>If <var>children</var>'s first member's [[previoussibling]] is an
+ <span>editable</span> [[br]], remove that [[br]] from its [[parent]].
</ol>
<li>Otherwise, if <var>start block</var> is a [[descendant]] of <var>end