Make autoimplementation work in IE9 again
authorAryeh Gregor <AryehGregor+gitcommit@gmail.com>
Fri, 25 Mar 2011 14:10:23 -0600
changeset 28 016f8f5f3c84
parent 27 61e55187231f
child 29 d90a865a34d8
Make autoimplementation work in IE9 again

Moving the contenteditable-setting from the div to the test cell turned
out to break IE.
autoimplementation.html
--- a/autoimplementation.html	Thu Mar 24 15:43:26 2011 -0600
+++ b/autoimplementation.html	Fri Mar 25 14:10:23 2011 -0600
@@ -445,6 +445,8 @@
 }
 
 function doSetup(command, idx) {
+	document.getElementById(command).contentEditable = "true";
+	document.getElementById(command).spellcheck = false;
 	var table = document.querySelectorAll("#" + command + " > table")[idx];
 
 	var tr = document.createElement("tr");
@@ -522,8 +524,6 @@
 	tr.appendChild(browserCell);
 	try {
 		var points = setupCell(browserCell, test);
-		browserCell.firstChild.contentEditable = "true";
-		browserCell.firstChild.spellcheck = false;
 		setSelection(points[0], points[1], points[2], points[3]);
 		try {
 			document.execCommand("styleWithCSS", false, styleWithCss);
@@ -533,8 +533,6 @@
 	} catch (e) {
 		browserCell.textContent = "Exception: " + e;
 	}
-	browserCell.firstChild.contentEditable = "inherit";
-	browserCell.firstChild.removeAttribute("spellcheck");
 }
 
 function doSameCell(tr) {
@@ -589,6 +587,7 @@
 function doTearDown(command) {
 	getSelection().removeAllRanges();
 	document.getElementById(command).contentEditable = "inherit";
+	document.getElementById(command).removeAttribute("spellcheck");
 }
 
 function setupCell(cell, test) {