--- a/conformancetest/runtest.html Wed Sep 07 09:28:19 2011 -0600
+++ b/conformancetest/runtest.html Wed Sep 07 09:47:00 2011 -0600
@@ -24,6 +24,16 @@
function runTests() {
var startTime = Date.now();
+
+ // Make document.body.innerHTML more tidy by removing unnecessary things.
+ // We can't remove the testharness.js script, because at the time of this
+ // writing, for some reason that stops it from adding appropriate CSS.
+ [].forEach.call(document.querySelectorAll("script"), function(node) {
+ if (!/testharness\.js$/.test(node.src)) {
+ node.parentNode.removeChild(node);
+ }
+ });
+
browserTests.forEach(runTest);
document.getElementById("test-container").parentNode
@@ -56,9 +66,11 @@
getSelection().removeAllRanges();
getSelection().addRange(range);
+ var originalRootElement = document.documentElement.cloneNode(true);
for (var i = 0; i < browserTest[1].length; i++) {
document.execCommand(browserTest[1][i][0], false, browserTest[1][i][1]);
}
+ var newRootElement = document.documentElement.cloneNode(true);
// Now do various sanity checks, and throw if they're violated. First
// just count children:
@@ -74,6 +86,16 @@
"Body element must have no attributes (<body>), but has more: " +
formatStartTag(document.body));
+ // Check that in general, nothing outside the test div was modified.
+ // TODO: Less verbose error reporting, the way some of the range tests
+ // do?
+ originalRootElement.querySelector("[contenteditable]").parentNode
+ .removeChild(originalRootElement.querySelector("[contenteditable]"));
+ newRootElement.querySelector("[contenteditable]").parentNode
+ .removeChild(newRootElement.querySelector("[contenteditable]"));
+ assert_equals(newRootElement.innerHTML, originalRootElement.innerHTML,
+ "Everything outside the editable div must be unchanged, but some change did occur");
+
normalizeSerializedStyle(testDiv);
setupDone = true;