Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / dynamic / insertAdjacentElement.html
blobc3d0bed3d4865b29fd14d2cf894a00efe82e10b6
1 <body>
2 <pre id="error-log"></pre>
3 <span id="container" style="color: green">
4 </span>
5 <div style="display: none">
6 <span id="1">
7 1 (black)
8 </span>
9 <span id="2">
10 2 (green)
11 </span>
12 <span id="3">
13 3 (green)
14 </span>
15 <span id="4">
16 4 (black)
17 </span>
18 </div>
19 <span id="status" style="color: red">
20 FAILURE
21 </span>
22 </body>
23 <script>
24 if (window.testRunner)
25 testRunner.dumpAsText();
27 // verify all standard cases
28 document.getElementById("container").insertAdjacentElement("beforeBegin", document.getElementById("1"));
29 document.getElementById("container").insertAdjacentElement("afterBegin", document.getElementById("2"));
30 document.getElementById("container").insertAdjacentElement("beforeEnd", document.getElementById("3"));
31 document.getElementById("container").insertAdjacentElement("afterEnd", document.getElementById("4"));
33 function assertThrows(func) {
34 var testPassed = false;
35 try {
36 func();
37 document.getElementById("error-log").textContent += "Expected exception missing.\n";
38 } catch (e) {
39 document.getElementById("error-log").textContent += "Caught expected exception: " + e + "\n";
40 testPassed = true;
42 return testPassed;
45 // check that exceptions are thrown as required
46 var passes = true;
47 passes = assertThrows(function() {
48 // should throw SyntaxError
49 document.getElementById("container").insertAdjacentElement("blah", document.getElementById("1"));
50 }) && passes;
51 passes = assertThrows(function() {
52 // should throw TypeError
53 document.getElementById("container").insertAdjacentElement("beforeEnd", null);
54 }) && passes;
55 passes = assertThrows(function() {
56 // should throw TypeError
57 document.getElementById("container").insertAdjacentElement("beforeEnd");
58 }) && passes;
59 passes = assertThrows(function() {
60 // should throw TypeError
61 document.getElementById("container").insertAdjacentElement();
62 }) && passes;
64 var elt = document.createElement("div");
65 passes = passes && (elt.insertAdjacentElement("beforeBegin", document.createElement("p")) == null);
66 if (passes) {
67 document.getElementById("status").style.color = "green";
68 document.getElementById("status").innerHTML = "<br><br>PASS";
70 </script>