Use testRunner instead of layoutTestController in fast/doctypes, dom, dynamic, encodi...
[WebKit-https.git] / LayoutTests / fast / dom / dom-method-document-change.html
1 <html>
2 <head>
3 <script>
4 if (window.testRunner)
5     testRunner.dumpAsText();
6
7 handler = function()
8 {
9     this.removeEventListener("DOMNodeRemoved", handler, false);
10     doc.adoptNode(this.parentElement);
11 }
12
13 showFailure = function(s)
14 {
15     document.body.innerHTML = "FAILURE: " + s;
16 }
17
18 window.onload = function()
19 {
20     element1 = document.createElement();
21     element2 = document.createElement();
22     element3 = document.createElement();
23     parent   = document.createElement();
24     dummy    = document.createElement();
25     
26     doc = document.implementation.createHTMLDocument();
27     
28     parent.appendChild(element1);
29     element1.addEventListener("DOMNodeRemoved", handler, false);
30     try {
31         document.body.appendChild(element1);
32     } catch (e) { }
33     if (element1.ownerDocument != element1.parentElement.ownerDocument)
34         return showFailure("appendChild");
35     
36     document.adoptNode(parent);
37     parent.appendChild(element2);
38     try {
39         doc.body.insertBefore(element2, dummy);
40     } catch (e) { }
41     if (element2.ownerDocument != element2.parentElement.ownerDocument)
42         return showFailure("insertBefore");
43     
44     parent.appendChild(element3);
45     try {
46         doc.body.replaceChild(element3, dummy);
47     } catch (e) { }
48     if (element3.ownerDocument != element3.parentElement.ownerDocument)
49         return showFailure("replaceChild");
50 }
51 </script>
52 </head>
53 <body>SUCCESS</body>
54 </html>