Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(435)

Side by Side Diff: recipes/web/html/removing_children.html

Issue 14109034: Recipes for using CSS Selectors with dart:html (Closed) Base URL: https://github.com/dart-lang/cookbook.git@master
Patch Set: Changes based on Kathy's comments. Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « recipes/web/html/removing.html ('k') | recipes/web/html/replacing.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2
3 <html>
4 <body>
5 <ol>
6 <li>Google</li>
7 <li>Wikipedia</li>
8 <li>Reddit</li>
9 <li class='news'>New York Times</li>
10 <li>Hacker News</li>
11 </ol>
12
13 <script type="application/dart">
14
15 import 'dart:html';
16
17 void main() {
18 var children = query('ol').children;
19
20
21 // RemoveAt()
22 assert(children[1].innerHtml == 'Wikipedia');
23 children.removeAt(1);
24 assert(children[1].innerHtml == 'Reddit');
25
26 print(children.runtimeType);
27
28 // removeLast()
29 children.removeLast();
30 assert(children.last.innerHtml == 'New York Times');
31
32 var news = query('.news');
33
34 children.remove(news);
35 assert(children.last.innerHtml == 'Reddit');
36
37 // BUG: RemoveWhere: does not work. retainWhere() also does not work.
38 // children.removeWhere((child) => child.innerHtml.length == 5);
39
40 children.clear();
41 assert(children.isEmpty);
42 }
43
44 </script>
45 <script src="packages/browser/dart.js"></script>
46 </body>
47 </html>
OLDNEW
« no previous file with comments | « recipes/web/html/removing.html ('k') | recipes/web/html/replacing.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698