| Index: recipes/web/html/removing_children.html
|
| diff --git a/recipes/web/html/removing_children.html b/recipes/web/html/removing_children.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..60d2a57f5faef079f4e2cb6cd4d83607376404cf
|
| --- /dev/null
|
| +++ b/recipes/web/html/removing_children.html
|
| @@ -0,0 +1,47 @@
|
| +<!DOCTYPE html>
|
| +
|
| +<html>
|
| + <body>
|
| + <ol>
|
| + <li>Google</li>
|
| + <li>Wikipedia</li>
|
| + <li>Reddit</li>
|
| + <li class='news'>New York Times</li>
|
| + <li>Hacker News</li>
|
| + </ol>
|
| +
|
| + <script type="application/dart">
|
| +
|
| + import 'dart:html';
|
| +
|
| + void main() {
|
| + var children = query('ol').children;
|
| +
|
| +
|
| + // RemoveAt()
|
| + assert(children[1].innerHtml == 'Wikipedia');
|
| + children.removeAt(1);
|
| + assert(children[1].innerHtml == 'Reddit');
|
| +
|
| + print(children.runtimeType);
|
| +
|
| + // removeLast()
|
| + children.removeLast();
|
| + assert(children.last.innerHtml == 'New York Times');
|
| +
|
| + var news = query('.news');
|
| +
|
| + children.remove(news);
|
| + assert(children.last.innerHtml == 'Reddit');
|
| +
|
| + // BUG: RemoveWhere: does not work. retainWhere() also does not work.
|
| + // children.removeWhere((child) => child.innerHtml.length == 5);
|
| +
|
| + children.clear();
|
| + assert(children.isEmpty);
|
| + }
|
| +
|
| + </script>
|
| + <script src="packages/browser/dart.js"></script>
|
| + </body>
|
| +</html>
|
|
|