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

Side by Side Diff: client/dom/templates/html/frog/impl_NodeList.darttemplate

Issue 9537001: Generate dart:html bindings for Dartium as well as Frog. All unittests now pass (or are disabled fo… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 9 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC {
6 _NodeJs _parent;
7
8 int get length() native "return this.length;";
9
10 _NodeJs operator[](int index) native "return this[index];";
11
12 void operator[]=(int index, _NodeJs value) {
13 throw new UnsupportedOperationException("Cannot assign element of immutable List.");
14 }
15 // -- start List<Node> mixins.
16 // Node is the element type.
17
18 // From Iterable<Node>:
19
20 Iterator<Node> iterator() {
21 // Note: NodeLists are not fixed size. And most probably length shouldn't
22 // be cached in both iterator _and_ forEach method. For now caching it
23 // for consistency.
24 return new _FixedSizeListIterator<Node>(this);
25 }
26
27 // From Collection<Node>:
28
29 void add(_NodeJs value) {
30 _parent._appendChild(value);
31 }
32
33 void addLast(_NodeJs value) {
34 _parent._appendChild(value);
35 }
36
37 void addAll(Collection<_NodeJs> collection) {
38 for (_NodeJs node in collection) {
39 _parent._appendChild(node);
40 }
41 }
42
43 void forEach(void f(Node element)) => _Collections.forEach(this, f);
44
45 Collection map(f(Node element)) => _Collections.map(this, [], f);
46
47 Collection<Node> filter(bool f(Node element)) =>
48 _Collections.filter(this, <Node>[], f);
49
50 bool every(bool f(Node element)) => _Collections.every(this, f);
51
52 bool some(bool f(Node element)) => _Collections.some(this, f);
53
54 bool isEmpty() => this.length == 0;
55
56 // From List<Node>:
57
58 void sort(int compare(Node a, Node b)) {
59 throw new UnsupportedOperationException("Cannot sort immutable List.");
60 }
61
62 int indexOf(Node element, [int start = 0]) =>
63 _Lists.indexOf(this, element, start, this.length);
64
65 int lastIndexOf(Node element, [int start = 0]) =>
66 _Lists.lastIndexOf(this, element, start);
67
68 Node last() => this[length - 1];
69
70 // FIXME: implement thesee.
71 void setRange(int start, int length, List<Node> from, [int startFrom]) {
72 throw new UnsupportedOperationException("Cannot setRange on immutable List." );
73 }
74 void removeRange(int start, int length) {
75 throw new UnsupportedOperationException("Cannot removeRange on immutable Lis t.");
76 }
77 void insertRange(int start, int length, [Node initialValue]) {
78 throw new UnsupportedOperationException("Cannot insertRange on immutable Lis t.");
79 }
80 List<Node> getRange(int start, int length) =>
81 _Lists.getRange(this, start, length, <Node>[]);
82
83 // -- end List<Node> mixins.
84
85 /*
86 Ignore members. TODO(jacobr): find a cleaner solution.
87 $!MEMBERS
88 */
89 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698