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:html'; |
| 11 |
| 12 class NodeTest { |
| 13 void testInsertBefore() { |
| 14 Element parent = document.query('#insert'); |
| 15 Element child = new Element.tag('div'); |
| 16 child.innerHtml = 'Inserted Child'; |
| 17 Element refChild = document.query('#refChild'); |
| 18 parent.insertBefore(child, refChild); |
| 19 } |
| 20 |
| 21 void testReplaceChild() { |
| 22 Element parent = document.query('#replace'); |
| 23 Element child = new Element.tag('div'); |
| 24 child.innerHtml = 'New Child'; |
| 25 Element oldChild = document.query('#oldChild'); |
| 26 oldChild.replaceWith(child); |
| 27 } |
| 28 |
| 29 void testRemoveChild() { |
| 30 Element parent = document.query('#remove'); |
| 31 Element child = document.query('#child'); |
| 32 child.remove(); |
| 33 } |
| 34 |
| 35 void testAppendChild() { |
| 36 Element parent = document.query('#append'); |
| 37 Element child = new Element.tag('div'); |
| 38 child.innerHtml = 'Appended Child'; |
| 39 parent.nodes.add(child); |
| 40 } |
| 41 } |
| 42 |
| 43 void main() { |
| 44 NodeTest tester = new NodeTest(); |
| 45 tester.testInsertBefore(); |
| 46 tester.testReplaceChild(); |
| 47 tester.testRemoveChild(); |
| 48 tester.testAppendChild(); |
| 49 } |
| 50 </script> |
| 51 |
| 52 <script> |
| 53 if (window.testRunner) |
| 54 window.testRunner.dumpAsText(); |
| 55 </script> |
| 56 |
| 57 </body> |
| 58 </html> |
OLD | NEW |