Remove list-item special-case from forwarddelete
authorAryeh Gregor <AryehGregor+gitcommit@gmail.com>
Wed, 15 Jun 2011 15:02:44 -0600
changeset 281 600d21af7922
parent 280 c6ebd85123d2
child 282 b788e889d5ed
Remove list-item special-case from forwarddelete

I got most of them before, but mistakenly left one in. With the cursor
at the end of a list item, delete should merge with the next item, not
just delete its marker.
editcommands.html
implementation.js
source.html
--- a/editcommands.html	Wed Jun 15 15:02:20 2011 -0600
+++ b/editcommands.html	Wed Jun 15 15:02:44 2011 -0600
@@ -4953,17 +4953,9 @@
 
   <!-- No special list-item behavior for forwardDelete. -->
 
-  <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="">end node</var> with <a class=external data-anolis-spec=domrange href=http://html5.org/specs/dom-range.html#concept-indexof title=concept-indexof>index</a> <var title="">end
-  offset</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 its <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
-  also 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>, set <var title="">end node</var> to its <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>
-  with <a class=external data-anolis-spec=domrange href=http://html5.org/specs/dom-range.html#concept-indexof title=concept-indexof>index</a> <var title="">end offset</var>, then set <var title="">end offset</var> to zero,
-  then set <var title="">node</var> to <var title="">end node</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>, then
-  set <var title="">offset</var> to <var title="">node</var>'s <a class=external data-anolis-spec=domrange href=http://html5.org/specs/dom-range.html#concept-node-length title=concept-node-length>length</a>.
-
-  <!-- General block-merging case. -->
-  <li>Otherwise, while <var title="">end node</var> has a <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> with <a class=external data-anolis-spec=domrange href=http://html5.org/specs/dom-range.html#concept-indexof title=concept-indexof>index</a>
-  <var title="">end offset</var>, set <var title="">end node</var> to that <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> and set
-  <var title="">end offset</var> to zero.
+  <li>While <var title="">end node</var> has a <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> with <a class=external data-anolis-spec=domrange href=http://html5.org/specs/dom-range.html#concept-indexof title=concept-indexof>index</a> <var title="">end
+  offset</var>, set <var title="">end node</var> to that <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> and set <var title="">end
+  offset</var> to zero.
 
   <li><a href=#delete-the-contents>Delete the contents</a> of the <a class=external data-anolis-spec=domrange href=http://html5.org/specs/dom-range.html#concept-range title=concept-range>range</a> with <a class=external data-anolis-spec=domrange href=http://html5.org/specs/dom-range.html#concept-range-start title=concept-range-start>start</a>
   (<var title="">node</var>, <var title="">offset</var>) 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="">end node</var>,
--- a/implementation.js	Wed Jun 15 15:02:20 2011 -0600
+++ b/implementation.js	Wed Jun 15 15:02:44 2011 -0600
@@ -5155,25 +5155,11 @@
 			return;
 		}
 
-		// "If the child of end node with index end offset is an li or dt or
-		// dd, and its previousSibling is also an li or dt or dd, set end node
-		// to its child with index end offset, then set end offset to zero,
-		// then set node to end node's previousSibling, then set offset to
-		// node's length."
-		if (isHtmlElement(endNode.childNodes[endOffset], ["li", "dt", "dd"])
-		&& isHtmlElement(endNode.childNodes[endOffset - 1], ["li", "dt", "dd"])) {
+		// "While end node has a child with index end offset, set end node to
+		// that child and set end offset to zero."
+		while (endOffset < endNode.childNodes.length) {
 			endNode = endNode.childNodes[endOffset];
 			endOffset = 0;
-			node = endNode.previousSibling;
-			offset = getNodeLength(node);
-
-		// "Otherwise, while end node has a child with index end offset, set
-		// end node to that child and set end offset to zero."
-		} else {
-			while (endOffset < endNode.childNodes.length) {
-				endNode = endNode.childNodes[endOffset];
-				endOffset = 0;
-			}
 		}
 
 		// "Delete the contents of the range with start (node, offset) and end
--- a/source.html	Wed Jun 15 15:02:20 2011 -0600
+++ b/source.html	Wed Jun 15 15:02:44 2011 -0600
@@ -4960,17 +4960,9 @@
 
   <!-- No special list-item behavior for forwardDelete. -->
 
-  <li>If the [[child]] of <var>end node</var> with [[index]] <var>end
-  offset</var> is an [[li]] or [[dt]] or [[dd]], and its [[previoussibling]] is
-  also an [[li]] or [[dt]] or [[dd]], set <var>end node</var> to its [[child]]
-  with [[index]] <var>end offset</var>, then set <var>end offset</var> to zero,
-  then set <var>node</var> to <var>end node</var>'s [[previoussibling]], then
-  set <var>offset</var> to <var>node</var>'s [[length]].
-
-  <!-- General block-merging case. -->
-  <li>Otherwise, while <var>end node</var> has a [[child]] with [[index]]
-  <var>end offset</var>, set <var>end node</var> to that [[child]] and set
-  <var>end offset</var> to zero.
+  <li>While <var>end node</var> has a [[child]] with [[index]] <var>end
+  offset</var>, set <var>end node</var> to that [[child]] and set <var>end
+  offset</var> to zero.
 
   <li><span>Delete the contents</span> of the [[range]] with [[rangestart]]
   (<var>node</var>, <var>offset</var>) and [[rangeend]] (<var>end node</var>,