2 <pre id=
"error-log"></pre>
3 <span id=
"container" style=
"color: green">
5 <span id=
"status" style=
"color: red">
10 if (window
.testRunner
)
11 testRunner
.dumpAsText();
13 // verify all standard cases
14 document
.getElementById("container").insertAdjacentText("beforeBegin", " 1 (black)");
15 document
.getElementById("container").insertAdjacentText("afterBegin", " 2 (green)");
16 document
.getElementById("container").insertAdjacentText("beforeEnd", " 3 (green)");
17 document
.getElementById("container").insertAdjacentText("afterEnd", " 4 (black)");
19 function assertThrows(func
) {
20 var testPassed
= false;
23 document
.getElementById("error-log").textContent
+= "Expected exception missing.\n";
25 document
.getElementById("error-log").textContent
+= "Caught expected exception: " + e
+ "\n";
31 // check that exceptions are thrown as required
33 passes
= assertThrows(function() {
34 // should throw SyntaxError
35 document
.getElementById("container").insertAdjacentText("blah", "text");
38 passes
= assertThrows(function() {
39 // should throw TypeError
40 document
.getElementById("container").insertAdjacentText();
43 passes
= assertThrows(function() {
44 // should throw TypeError
45 document
.getElementById("container").insertAdjacentText("afterBegin");
49 document
.getElementById("status").style
.color
= "green";
50 document
.getElementById("status").innerHTML
= "<br><br>PASS";