Fix extremely stupid implementation bug
authorAryeh Gregor <AryehGregor+gitcommit@gmail.com>
Sun, 24 Jul 2011 09:46:34 -0600
changeset 447 79d78ab07506
parent 446 2e6ffc2bd1bb
child 448 68aaba1b5fd4
Fix extremely stupid implementation bug

I have no idea why this wasn't causing visible problems before. I was
setting the start node of the range to its parent, then setting the end
node of the range to the parent of the *new* start node.
implementation.js
--- a/implementation.js	Sun Jul 24 09:31:33 2011 -0600
+++ b/implementation.js	Sun Jul 24 09:46:34 2011 -0600
@@ -6395,7 +6395,7 @@
 		if (getActiveRange().startContainer.nodeType == Node.TEXT_NODE
 		&& getActiveRange().startOffset == 0) {
 			getActiveRange().setStart(getActiveRange().startContainer.parentNode, getNodeIndex(getActiveRange().startContainer));
-			getActiveRange().setEnd(getActiveRange().startContainer.parentNode, getNodeIndex(getActiveRange().startContainer));
+			getActiveRange().collapse(true);
 		}
 
 		// "If the active range's start node is a Text node and its start
@@ -6404,7 +6404,7 @@
 		if (getActiveRange().startContainer.nodeType == Node.TEXT_NODE
 		&& getActiveRange().startOffset == getNodeLength(getActiveRange().startContainer)) {
 			getActiveRange().setStart(getActiveRange().startContainer.parentNode, 1 + getNodeIndex(getActiveRange().startContainer));
-			getActiveRange().setEnd(getActiveRange().startContainer.parentNode, 1 + getNodeIndex(getActiveRange().startContainer));
+			getActiveRange().collapse(true);
 		}
 
 		// "Let hr be the result of calling createElement("hr") on the
@@ -6592,7 +6592,7 @@
 		if (getActiveRange().startContainer.nodeType == Node.TEXT_NODE
 		&& getActiveRange().startOffset == 0) {
 			getActiveRange().setStart(getActiveRange().startContainer.parentNode, getNodeIndex(getActiveRange().startContainer));
-			getActiveRange().setEnd(getActiveRange().startContainer.parentNode, getNodeIndex(getActiveRange().startContainer));
+			getActiveRange().collapse(true);
 		}
 
 		// "If the active range's start node is a Text node and its start
@@ -6601,7 +6601,7 @@
 		if (getActiveRange().startContainer.nodeType == Node.TEXT_NODE
 		&& getActiveRange().startOffset == getNodeLength(getActiveRange().startContainer)) {
 			getActiveRange().setStart(getActiveRange().startContainer.parentNode, 1 + getNodeIndex(getActiveRange().startContainer));
-			getActiveRange().setEnd(getActiveRange().startContainer.parentNode, 1 + getNodeIndex(getActiveRange().startContainer));
+			getActiveRange().collapse(true);
 		}
 
 		// "Let br be the result of calling createElement("br") on the context