| <body> |
| <pre id="error-log"></pre> |
| <span id="container" style="color: green"> |
| </span> |
| <span id="status" style="color: red"> |
| FAILURE |
| </span> |
| </body> |
| <script> |
| if (window.layoutTestController) |
| layoutTestController.dumpAsText(); |
| |
| // verify all standard cases |
| document.getElementById("container").insertAdjacentHTML("beforeBegin", "<span id='1''> 1 (black)</span>"); |
| document.getElementById("container").insertAdjacentHTML("afterBegin", "<span id='2''> 2 (green)</span>"); |
| document.getElementById("container").insertAdjacentHTML("beforeEnd", "<span id='3''> 3 (green)</span>"); |
| document.getElementById("container").insertAdjacentHTML("afterEnd", "<span id='4''> 4 (black)</span>"); |
| |
| function assertThrows(func) { |
| var testPassed = false; |
| try { |
| func(); |
| } catch (e) { |
| document.getElementById("error-log").innerHTML += "Caught expected exception: " + e + "\n"; |
| testPassed = true; |
| } |
| return testPassed; |
| } |
| |
| // check that exceptions are thrown as required |
| var passes = true; |
| passes = passes & assertThrows(function() { |
| // should throw TYPE_MISMATCH_ERR |
| document.getElementById("container").insertAdjacentHTML("blah", "<span>html</span>"); |
| }); |
| |
| if (passes) { |
| document.getElementById("status").style.color = "green"; |
| document.getElementById("status").innerHTML = "<br<br>PASS"; |
| } |
| </script> |