--- a/editcommands.html Mon May 16 14:42:53 2011 -0600
+++ b/editcommands.html Mon May 16 14:48:56 2011 -0600
@@ -3072,12 +3072,7 @@
<ol>
<li>If <var title="">node</var> is not <a href=#editable>editable</a>, abort these steps.
- <li>If <var title="">node</var> is an <code class=external data-anolis-spec=html title="the ol element"><a href=http://www.whatwg.org/html/#the-ol-element>ol</a></code> or <code class=external data-anolis-spec=html title="the ul element"><a href=http://www.whatwg.org/html/#the-ul-element>ul</a></code> with no attributes except
- possibly <code class=external data-anolis-spec=html title=attr-ol-reversed><a href=http://www.whatwg.org/html/#attr-ol-reversed>reversed</a></code>,
- <code class=external data-anolis-spec=html title=attr-ol-start><a href=http://www.whatwg.org/html/#attr-ol-start>start</a></code>, and/or <code class=external data-anolis-spec=html title=attr-ol-type><a href=http://www.whatwg.org/html/#attr-ol-type>type</a></code>; or is an <code class=external data-anolis-spec=html title="the ol element"><a href=http://www.whatwg.org/html/#the-ol-element>ol</a></code> or
- <code class=external data-anolis-spec=html title="the ul element"><a href=http://www.whatwg.org/html/#the-ul-element>ul</a></code> whose <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 also an <code class=external data-anolis-spec=html title="the ol element"><a href=http://www.whatwg.org/html/#the-ol-element>ol</a></code> or <code class=external data-anolis-spec=html title="the ul element"><a href=http://www.whatwg.org/html/#the-ul-element>ul</a></code>:
- <!-- If it has reversed/start/type, those can't reasonably be preserved no
- matter what. Not clear how it's supposed to get them, anyway. -->
+ <li>If <var title="">node</var> is an <code class=external data-anolis-spec=html title="the ol element"><a href=http://www.whatwg.org/html/#the-ol-element>ol</a></code> or <code class=external data-anolis-spec=html title="the ul element"><a href=http://www.whatwg.org/html/#the-ul-element>ul</a></code>:
<div class=XXX>
<p>We don't handle a case like
@@ -3091,26 +3086,15 @@
</div>
<ol>
- <li>Let <var title="">children</var> be 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>children</a> of <var title="">node</var>.
-
- <li>Remove <var title="">node</var>, <a href=#preserving-its-descendants>preserving its descendants</a>.
-
- <li><a href=#fix-orphaned-list-items>Fix orphaned list items</a> in <var title="">children</var>.
-
- <li>Abort these steps.
- </ol>
-
- <li>If <var title="">node</var> is an <code class=external data-anolis-spec=html title="the ol element"><a href=http://www.whatwg.org/html/#the-ol-element>ol</a></code> or <code class=external data-anolis-spec=html title="the ul element"><a href=http://www.whatwg.org/html/#the-ul-element>ul</a></code>:
- <!-- But it has non-list attributes, and its parent is not an ol/ul, or we'd
- have handled it in the previous step. -->
-
- <ol>
<li>Unset the <code class=external data-anolis-spec=html title=attr-ol-reversed><a href=http://www.whatwg.org/html/#attr-ol-reversed>reversed</a></code>, <code class=external data-anolis-spec=html title=attr-ol-start><a href=http://www.whatwg.org/html/#attr-ol-start>start</a></code>, and <code class=external data-anolis-spec=html title=attr-ol-type><a href=http://www.whatwg.org/html/#attr-ol-type>type</a></code> attributes of <var title="">node</var>, if any are
set.
<li>Let <var title="">children</var> be 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>children</a> of <var title="">node</var>.
- <li><a href=#set-the-tag-name>Set the tag name</a> of <var title="">node</var> to "div".
+ <li>If <var title="">node</var> has attributes, and 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> or not an <code class=external data-anolis-spec=html title="the ol element"><a href=http://www.whatwg.org/html/#the-ol-element>ol</a></code>
+ or <code class=external data-anolis-spec=html title="the ul element"><a href=http://www.whatwg.org/html/#the-ul-element>ul</a></code>, <a href=#set-the-tag-name>set the tag name</a> of <var title="">node</var> to "div".
+
+ <li>Otherwise remove <var title="">node</var>, <a href=#preserving-its-descendants>preserving its descendants</a>.
<li><a href=#fix-orphaned-list-items>Fix orphaned list items</a> in <var title="">children</var>.
--- a/implementation.js Mon May 16 14:42:53 2011 -0600
+++ b/implementation.js Mon May 16 14:48:56 2011 -0600
@@ -3246,27 +3246,6 @@
return;
}
- // "If node is an ol or ul with no attributes except possibly reversed,
- // start, and/or type; or is an ol or ul whose parent is also an ol or ul:"
- if ((isHtmlElement(node, "OL") || isHtmlElement(node, "UL"))
- && (
- isHtmlElement(node.parentNode, "OL")
- || isHtmlElement(node.parentNode, "UL")
- || [].every.call(node.attributes, function (attr) { return ["reversed", "start", "type"].indexOf(attr.name) != -1 })
- )) {
- // "Let children be the children of node."
- var children = [].slice.call(node.childNodes);
-
- // "Remove node, preserving its descendants."
- removePreservingDescendants(node);
-
- // "Fix orphaned list items in children."
- fixOrphanedListItems(children);
-
- // "Abort these steps."
- return;
- }
-
// "If node is an ol or ul:"
if (isHtmlElement(node, "OL")
|| isHtmlElement(node, "UL")) {
@@ -3279,8 +3258,17 @@
// "Let children be the children of node."
var children = [].slice.call(node.childNodes);
- // "Set the tag name of node to "div"."
- setTagName(node, "div");
+ // "If node has attributes, and its parent or not an ol or ul, set the
+ // tag name of node to "div"."
+ if (node.attributes.length
+ && !isHtmlElement(node.parentNode, "OL")
+ && !isHtmlElement(node.parentNode, "UL")) {
+ setTagName(node, "div");
+
+ // "Otherwise remove node, preserving its descendants."
+ } else {
+ removePreservingDescendants(node);
+ }
// "Fix orphaned list items in children."
fixOrphanedListItems(children);
--- a/source.html Mon May 16 14:42:53 2011 -0600
+++ b/source.html Mon May 16 14:48:56 2011 -0600
@@ -3120,13 +3120,7 @@
<ol>
<li>If <var>node</var> is not <span>editable</span>, abort these steps.
- <li>If <var>node</var> is an [[ol]] or [[ul]] with no attributes except
- possibly <code data-anolis-spec=html title=attr-ol-reversed>reversed</code>,
- <code data-anolis-spec=html title=attr-ol-start>start</code>, and/or <code
- data-anolis-spec=html title=attr-ol-type>type</code>; or is an [[ol]] or
- [[ul]] whose [[parent]] is also an [[ol]] or [[ul]]:
- <!-- If it has reversed/start/type, those can't reasonably be preserved no
- matter what. Not clear how it's supposed to get them, anyway. -->
+ <li>If <var>node</var> is an [[ol]] or [[ul]]:
<div class=XXX>
<p>We don't handle a case like
@@ -3140,20 +3134,6 @@
</div>
<ol>
- <li>Let <var>children</var> be the [[children]] of <var>node</var>.
-
- <li>Remove <var>node</var>, <span>preserving its descendants</span>.
-
- <li><span>Fix orphaned list items</span> in <var>children</var>.
-
- <li>Abort these steps.
- </ol>
-
- <li>If <var>node</var> is an [[ol]] or [[ul]]:
- <!-- But it has non-list attributes, and its parent is not an ol/ul, or we'd
- have handled it in the previous step. -->
-
- <ol>
<li>Unset the <code data-anolis-spec=html
title=attr-ol-reversed>reversed</code>, <code data-anolis-spec=html
title=attr-ol-start>start</code>, and <code data-anolis-spec=html
@@ -3162,7 +3142,10 @@
<li>Let <var>children</var> be the [[children]] of <var>node</var>.
- <li><span>Set the tag name</span> of <var>node</var> to "div".
+ <li>If <var>node</var> has attributes, and its [[parent]] or not an [[ol]]
+ or [[ul]], <span>set the tag name</span> of <var>node</var> to "div".
+
+ <li>Otherwise remove <var>node</var>, <span>preserving its descendants</span>.
<li><span>Fix orphaned list items</span> in <var>children</var>.