Improve DOM round-tripping checks
authorAryeh Gregor <AryehGregor+gitcommit@gmail.com>
Mon, 23 May 2011 14:50:26 -0600
changeset 163 b8ce2db14e48
parent 162 14e80c71bb73
child 164 a841873c905a
Improve DOM round-tripping checks

Removes a false positive in IE9.
autoimplementation.html
--- a/autoimplementation.html	Sun May 22 15:37:45 2011 -0600
+++ b/autoimplementation.html	Mon May 23 14:50:26 2011 -0600
@@ -1741,7 +1741,11 @@
 		compareDiv1.normalize();
 		var compareDiv2 = compareDiv1.cloneNode(false);
 		compareDiv2.innerHTML = compareDiv1.innerHTML;
-		if (compareDiv1.innerHTML != compareDiv2.innerHTML) {
+		// Oddly, IE9 sometimes produces two nodes that return true for
+		// isEqualNode but have different innerHTML (omitting closing tags vs.
+		// not).
+		if (!compareDiv1.isEqualNode(compareDiv2)
+		&& compareDiv1.innerHTML != compareDiv2.innerHTML) {
 			throw "DOM does not round-trip through serialization!  "
 				+ compareDiv1.innerHTML + " vs. " + compareDiv2.innerHTML;
 		}
@@ -1875,7 +1879,8 @@
 		}
 		var compareDiv2 = compareDiv1.cloneNode(false);
 		compareDiv2.innerHTML = compareDiv1.innerHTML;
-		if (compareDiv1.innerHTML != compareDiv2.innerHTML) {
+		if (!compareDiv1.isEqualNode(compareDiv2)
+		&& compareDiv1.innerHTML != compareDiv2.innerHTML) {
 			throw "DOM does not round-trip through serialization!  "
 				+ compareDiv1.innerHTML + " vs. " + compareDiv2.innerHTML;
 		}