Collapsing a selection on a ProcessingInstruction [1], or extending a selection
authorstighal@opera.com
Thu, 12 Jan 2012 11:32:57 +0100
changeset 685 9ca0bc5d4285
parent 684 4058e0a2965f
child 686 56c83bbaa44c
Collapsing a selection on a ProcessingInstruction [1], or extending a selection
to a PI [2], should not throw an exception, neither according to the Selection
spec nor the DOM Range spec for setting boundary points [3].

[1]
http://dvcs.w3.org/hg/editing/raw-file/tip/editing.html#dom-selection-collapse
[2]
http://dvcs.w3.org/hg/editing/raw-file/tip/editing.html#dom-selection-extend
[3]
http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-range-bp-set
selecttest/collapse.html
selecttest/extend.html
--- a/selecttest/collapse.html	Wed Jan 11 13:38:32 2012 -0700
+++ b/selecttest/collapse.html	Thu Jan 12 11:32:57 2012 +0100
@@ -14,11 +14,10 @@
 		selection.addRange(addedRange);
 	}
 
-	if (point[0].nodeType == Node.DOCUMENT_TYPE_NODE
-	|| point[0].nodeType == Node.PROCESSING_INSTRUCTION_NODE) {
+	if (point[0].nodeType == Node.DOCUMENT_TYPE_NODE) {
 		assert_throws("INVALID_NODE_TYPE_ERR", function() {
 			selection.collapse(point[0], point[1]);
-		}, "Must throw INVALID_NODE_TYPE_ERR when collapse()ing if the node is a DocumentType or ProcessingInstruction");
+		}, "Must throw INVALID_NODE_TYPE_ERR when collapse()ing if the node is a DocumentType");
 		return;
 	}
 
--- a/selecttest/extend.html	Wed Jan 11 13:38:32 2012 -0700
+++ b/selecttest/extend.html	Thu Jan 12 11:32:57 2012 +0100
@@ -108,11 +108,10 @@
 		return;
 	}
 
-	if (node.nodeType == Node.DOCUMENT_TYPE_NODE
-	|| node.nodeType == Node.PROCESSING_INSTRUCTION_NODE) {
+	if (node.nodeType == Node.DOCUMENT_TYPE_NODE) {
 		assert_throws("INVALID_NODE_TYPE_ERR", function() {
 			selection.extend(node, offset);
-		}, "extend() to a doctype or PI must throw INVALID_NODE_TYPE_ERR");
+		}, "extend() to a doctype must throw INVALID_NODE_TYPE_ERR");
 		return;
 	}