Extra sanity check in gentest.html
authorAryeh Gregor <AryehGregor+gitcommit@gmail.com>
Wed, 07 Sep 2011 11:40:40 -0600
changeset 570 de488704b7c6
parent 569 cc3b4fff8938
child 571 efda2a3a76b8
Extra sanity check in gentest.html

Doesn't appear to have triggered any new errors.
conformancetest/gentest.html
--- a/conformancetest/gentest.html	Wed Sep 07 11:18:48 2011 -0600
+++ b/conformancetest/gentest.html	Wed Sep 07 11:40:40 2011 -0600
@@ -105,10 +105,29 @@
 		range.setEnd(points[0], points[1]);
 	}
 
+	// Verify that we aren't touching any non-editable nodes
+	var nonEditable = getDescendants(testDiv).filter(function(node) {
+		return !isEditable(node);
+	});
+	var nonEditableClones = nonEditable.map(function(node) {
+		return node.cloneNode(false);
+	});
+
 	for (var i = 1; i < test.length; i++) {
 		myExecCommand(test[i][0], false, test[i][1], range);
 	}
 
+	for (var i = 0; i < nonEditable.length; i++) {
+		if (!isDescendant(nonEditable[i], testDiv)) {
+			throw "Non-editable node " + i + " is no longer descendant of test div: "
+				+ nonEditable[i];
+		}
+		if (!nonEditableClones[i].isEqualNode(nonEditable[i].cloneNode(false))) {
+			throw "Non-editable node " + i + " has changed: "
+				+ nonEditable[i];
+		}
+	}
+
 	var compareDiv1 = testDiv.cloneNode(true);
 
 	// Now do various sanity checks, and throw if they're violated.  First