--- a/editcommands.html Sun Jun 12 14:11:32 2011 -0600
+++ b/editcommands.html Sun Jun 12 14:34:36 2011 -0600
@@ -2562,6 +2562,33 @@
(<var title="">node</var>, <var title="">offset</var> − 1) and <a class=external data-anolis-spec=domrange href=http://html5.org/specs/dom-range.html#concept-range-end title=concept-range-end>end</a>
(<var title="">node</var>, <var title="">offset</var>) and abort these steps.
+ <!--
+ If we're at the beginning of a list, we want to outdent the first list item.
+ This doesn't actually match anyone or anything. Word 2007 and OpenOffice.org
+ 3.2.1 Ubuntu just remove the list marker, which is weird and doesn't map well
+ to HTML. Browsers tend to just merge with the preceding block, which isn't
+ expected.
+ -->
+ <li>If <var title="">node</var> is an <code class=external data-anolis-spec=html title="the li element"><a href=http://www.whatwg.org/html/#the-li-element>li</a></code> or <code class=external data-anolis-spec=html title="the dt element"><a href=http://www.whatwg.org/html/#the-dt-element>dt</a></code> or <code class=external data-anolis-spec=html title="the dd element"><a href=http://www.whatwg.org/html/#the-dd-element>dd</a></code> and is the first
+ <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 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>Let <var title="">items</var> be a list of all <code class=external data-anolis-spec=html title="the li element"><a href=http://www.whatwg.org/html/#the-li-element>li</a></code>s that are
+ <a class=external data-anolis-spec=domcore href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-tree-ancestor title=concept-tree-ancestor>ancestors</a> of <var title="">node</var>.
+
+ <li><a href=#normalize-sublists>Normalize sublists</a> of each <var title="">item</var> in
+ <var title="">items</var>.
+
+ <li><a href=#split-the-parent>Split the parent</a> of the one-<a class=external data-anolis-spec=domcore href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-node title=concept-node>node</a> list consisting of
+ <var title="">node</var>.
+
+ <li><a href=#fix-disallowed-ancestors>Fix disallowed ancestors</a> of <var title="">node</var>.
+
+ <li>Abort these steps.
+ </ol>
+
+ <p class=XXX>blockquote?
+
<!-- By this point, we're almost certainly going to merge something, and the
only question is what. -->
<li>Let <var title="">start node</var> equal <var title="">node</var> and let <var title="">start
--- a/implementation.js Sun Jun 12 14:11:32 2011 -0600
+++ b/implementation.js Sun Jun 12 14:34:36 2011 -0600
@@ -3280,6 +3280,34 @@
return;
}
+ // "If node is an li or dt or dd and is the first child of its parent:"
+ if (isHtmlElement(node, ["li", "dt", "dd"])
+ && node == node.parentNode.firstChild) {
+ // "Let items be a list of all lis that are ancestors of node."
+ //
+ // Remember, must be in tree order.
+ var items = [];
+ for (var ancestor = node.parentNode; ancestor; ancestor = ancestor.parentNode) {
+ if (isHtmlElement(ancestor, "li")) {
+ items.unshift(ancestor);
+ }
+ }
+
+ // "Normalize sublists of each item in items."
+ for (var i = 0; i < items.length; i++) {
+ normalizeSublists(items[i]);
+ }
+
+ // "Split the parent of the one-node list consisting of node."
+ splitParent([node]);
+
+ // "Fix disallowed ancestors of node."
+ fixDisallowedAncestors(node);
+
+ // "Abort these steps."
+ return;
+ }
+
// "Let start node equal node and let start offset equal offset."
var startNode = node;
var startOffset = offset;
--- a/source.html Sun Jun 12 14:11:32 2011 -0600
+++ b/source.html Sun Jun 12 14:34:36 2011 -0600
@@ -2542,6 +2542,33 @@
(<var>node</var>, <var>offset</var> − 1) and [[rangeend]]
(<var>node</var>, <var>offset</var>) and abort these steps.
+ <!--
+ If we're at the beginning of a list, we want to outdent the first list item.
+ This doesn't actually match anyone or anything. Word 2007 and OpenOffice.org
+ 3.2.1 Ubuntu just remove the list marker, which is weird and doesn't map well
+ to HTML. Browsers tend to just merge with the preceding block, which isn't
+ expected.
+ -->
+ <li>If <var>node</var> is an [[li]] or [[dt]] or [[dd]] and is the first
+ [[child]] of its [[parent]]:
+
+ <ol>
+ <li>Let <var>items</var> be a list of all [[li]]s that are
+ [[ancestors]] of <var>node</var>.
+
+ <li><span>Normalize sublists</span> of each <var>item</var> in
+ <var>items</var>.
+
+ <li><span>Split the parent</span> of the one-[[node]] list consisting of
+ <var>node</var>.
+
+ <li><span>Fix disallowed ancestors</span> of <var>node</var>.
+
+ <li>Abort these steps.
+ </ol>
+
+ <p class=XXX>blockquote?
+
<!-- By this point, we're almost certainly going to merge something, and the
only question is what. -->
<li>Let <var>start node</var> equal <var>node</var> and let <var>start
--- a/tests.js Sun Jun 12 14:11:32 2011 -0600
+++ b/tests.js Sun Jun 12 14:34:36 2011 -0600
@@ -300,6 +300,7 @@
// Lists with collapsed selection
'foo<ol><li>[]bar<li>baz</ol>',
'foo<br><ol><li>[]bar<li>baz</ol>',
+ 'foo<br><br><ol><li>[]bar<li>baz</ol>',
'<ol><li>foo<li>[]bar</ol>',
'<ol><li>foo<br><li>[]bar</ol>',
'<ol><li>foo<br><br><li>[]bar</ol>',
@@ -310,6 +311,10 @@
'<ol><li>foo<li><p>[]bar</ol>',
'<ol><li><p>foo<li><p>[]bar</ol>',
+ '<ol><li>foo<ul><li>[]bar</ul></ol>',
+ 'foo<ol><ol><li>[]bar</ol></ol>',
+ 'foo<div><ol><li>[]bar</ol></div>',
+
'foo<dl><dt>[]bar<dd>baz</dl>',
'foo<dl><dd>[]bar</dl>',
'<dl><dt>foo<dd>[]bar</dl>',