--- a/editcommands.html Fri May 13 14:32:20 2011 -0600
+++ b/editcommands.html Fri May 13 14:32:48 2011 -0600
@@ -2912,11 +2912,20 @@
<li>Set <var title="">ol</var> to its last <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>.
</ol>
- <li>If <var title="">ol</var> is not an <a href=#editable>editable</a> <code class=external data-anolis-spec=html title="the ol element"><a href=http://www.whatwg.org/html/#the-ol-element>ol</a></code>, let
- <var title="">ol</var> be the result of calling <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("ol")</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 the first member of <var title="">sublist</var>. Insert
- <var title="">ol</var> into <var title="">original parent</var> immediately before the
- first member of <var title="">sublist</var>.
+ <li>If <var title="">ol</var> is not an <a href=#editable>editable</a> <code class=external data-anolis-spec=html title="the ol element"><a href=http://www.whatwg.org/html/#the-ol-element>ol</a></code>:
+
+ <ol>
+ <li>If <var title="">original parent</var> is a <code class=external data-anolis-spec=html title="the p element"><a href=http://www.whatwg.org/html/#the-p-element>p</a></code>, <a href=#split-the-parent>split the
+ parent</a> of <var title="">sublist</var>, with <var title="">new parent</var> null,
+ and then set <var title="">original parent</var> to 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 the
+ first member of <var title="">sublist</var>.
+
+ <li>Let <var title="">ol</var> be the result of calling <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("ol")</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 the first member of <var title="">sublist</var>.
+
+ <li>Insert <var title="">ol</var> into <var title="">original parent</var> immediately
+ before the first member of <var title="">sublist</var>.
+ </ol>
<li>Append <var title="">li</var> as the last <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="">ol</var>,
<a href=#preserving-ranges>preserving ranges</a>.
--- a/implementation.js Fri May 13 14:32:20 2011 -0600
+++ b/implementation.js Fri May 13 14:32:48 2011 -0600
@@ -2779,13 +2779,26 @@
ol = ol.lastChild;
}
- // "If ol is not an editable ol, let ol be the result of
- // calling createElement("ol") on the ownerDocument of the
- // first member of sublist. Insert ol into original parent
- // immediately before the first member of sublist."
+ // "If ol is not an editable ol:
if (!isEditable(ol)
|| !isHtmlElement(ol, "OL")) {
+ // "If original parent is a p, split the parent of
+ // sublist, with new parent null, and then set original
+ // parent to the parent of the first member of
+ // sublist."
+ if (isHtmlElement(originalParent, "P")) {
+ splitParent(sublist, null);
+
+ originalParent = sublist[0].parentNode;
+ }
+
+ // "Let ol be the result of calling createElement("ol")
+ // on the ownerDocument of the first member of
+ // sublist."
ol = sublist[0].ownerDocument.createElement("ol");
+
+ // "Insert ol into original parent immediately before
+ // the first member of sublist."
originalParent.insertBefore(ol, sublist[0]);
}
--- a/source.html Fri May 13 14:32:20 2011 -0600
+++ b/source.html Fri May 13 14:32:48 2011 -0600
@@ -2961,12 +2961,22 @@
<li>Set <var>ol</var> to its last [[child]].
</ol>
- <li>If <var>ol</var> is not an <span>editable</span> [[ol]], let
- <var>ol</var> be the result of calling <code data-anolis-spec=domcore
- title=dom-Document-createElement>createElement("ol")</code> on the
- [[ownerdocument]] of the first member of <var>sublist</var>. Insert
- <var>ol</var> into <var>original parent</var> immediately before the
- first member of <var>sublist</var>.
+ <li>If <var>ol</var> is not an <span>editable</span> [[ol]]:
+
+ <ol>
+ <li>If <var>original parent</var> is a [[p]], <span>split the
+ parent</span> of <var>sublist</var>, with <var>new parent</var> null,
+ and then set <var>original parent</var> to the [[parent]] of the
+ first member of <var>sublist</var>.
+
+ <li>Let <var>ol</var> be the result of calling <code
+ data-anolis-spec=domcore
+ title=dom-Document-createElement>createElement("ol")</code> on the
+ [[ownerdocument]] of the first member of <var>sublist</var>.
+
+ <li>Insert <var>ol</var> into <var>original parent</var> immediately
+ before the first member of <var>sublist</var>.
+ </ol>
<li>Append <var>li</var> as the last [[child]] of <var>ol</var>,
<span>preserving ranges</span>.