| OLD | NEW |
| (Empty) |
| 1 <html> | |
| 2 <body> | |
| 3 | |
| 4 <div id="insert">*Insert Test Parent*<div id="refChild">Reference Child</div></d
iv> | |
| 5 <div id="replace">*Replace Test Parent*<div id="oldChild">Old Child</div></div> | |
| 6 <div id="remove">*Remove Test Parent*<div id="child">Child</div></div> | |
| 7 <div id="append">*Append Test Parent*</div> | |
| 8 | |
| 9 <script id="dart" type="application/dart"> | |
| 10 #import('dart:dom'); | |
| 11 | |
| 12 class NodeTest { | |
| 13 | |
| 14 NodeTest() {} | |
| 15 | |
| 16 void testInsertBefore() { | |
| 17 HTMLElement parent = document.getElementById('insert'); | |
| 18 HTMLElement child = document.createElement('div'); | |
| 19 child.innerHTML = 'Inserted Child'; | |
| 20 HTMLElement refChild = document.getElementById('refChild'); | |
| 21 parent.insertBefore(child, refChild); | |
| 22 } | |
| 23 | |
| 24 void testReplaceChild() { | |
| 25 HTMLElement parent = document.getElementById('replace'); | |
| 26 HTMLElement child = document.createElement('div'); | |
| 27 child.innerHTML = 'New Child'; | |
| 28 HTMLElement oldChild = document.getElementById('oldChild'); | |
| 29 parent.replaceChild(child, oldChild); | |
| 30 } | |
| 31 | |
| 32 void testRemoveChild() { | |
| 33 HTMLElement parent = document.getElementById('remove'); | |
| 34 HTMLElement child = document.getElementById('child'); | |
| 35 parent.removeChild(child); | |
| 36 } | |
| 37 | |
| 38 void testAppendChild() { | |
| 39 HTMLElement parent = document.getElementById('append'); | |
| 40 HTMLElement child = document.createElement('div'); | |
| 41 child.innerHTML = 'Appended Child'; | |
| 42 parent.appendChild(child); | |
| 43 } | |
| 44 } | |
| 45 | |
| 46 void main() { | |
| 47 if (null !== layoutTestController) { | |
| 48 layoutTestController.dumpAsText(); | |
| 49 } | |
| 50 NodeTest tester = new NodeTest(); | |
| 51 tester.testInsertBefore(); | |
| 52 tester.testReplaceChild(); | |
| 53 tester.testRemoveChild(); | |
| 54 tester.testAppendChild(); | |
| 55 } | |
| 56 </script> | |
| 57 | |
| 58 <script> | |
| 59 // Fake script to trigger Dart execution. | |
| 60 </script> | |
| 61 | |
| 62 </body> | |
| 63 </html> | |
| OLD | NEW |