| <html> |
| <body> |
| |
| <div id="insert">*Insert Test Parent*<div id="refChild">Reference Child</div></div> |
| <div id="replace">*Replace Test Parent*<div id="oldChild">Old Child</div></div> |
| <div id="remove">*Remove Test Parent*<div id="child">Child</div></div> |
| <div id="append">*Append Test Parent*</div> |
| |
| <script id="dart" type="application/dart"> |
| import 'dart:html'; |
| |
| class NodeTest { |
| void testInsertBefore() { |
| Element parent = document.query('#insert'); |
| Element child = new Element.tag('div'); |
| child.innerHtml = 'Inserted Child'; |
| Element refChild = document.query('#refChild'); |
| parent.insertBefore(child, refChild); |
| } |
| |
| void testReplaceChild() { |
| Element parent = document.query('#replace'); |
| Element child = new Element.tag('div'); |
| child.innerHtml = 'New Child'; |
| Element oldChild = document.query('#oldChild'); |
| oldChild.replaceWith(child); |
| } |
| |
| void testRemoveChild() { |
| Element parent = document.query('#remove'); |
| Element child = document.query('#child'); |
| child.remove(); |
| } |
| |
| void testAppendChild() { |
| Element parent = document.query('#append'); |
| Element child = new Element.tag('div'); |
| child.innerHtml = 'Appended Child'; |
| parent.nodes.add(child); |
| } |
| } |
| |
| void main() { |
| NodeTest tester = new NodeTest(); |
| tester.testInsertBefore(); |
| tester.testReplaceChild(); |
| tester.testRemoveChild(); |
| tester.testAppendChild(); |
| } |
| </script> |
| |
| <script> |
| if (window.testRunner) |
| window.testRunner.dumpAsText(); |
| </script> |
| |
| </body> |
| </html> |