OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 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 | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 part of $LIBRARYNAME; | 5 part of $LIBRARYNAME; |
6 | 6 |
7 // TODO(jacobr): use _Lists.dart to remove some of the duplicated | 7 // TODO(jacobr): use _Lists.dart to remove some of the duplicated |
8 // functionality. | 8 // functionality. |
9 class _ChildrenElementList implements List { | 9 class _ChildrenElementList implements List<Element> { |
10 // Raw Element. | 10 // Raw Element. |
11 final Element _element; | 11 final Element _element; |
12 final HtmlCollection _childElements; | 12 final HtmlCollection _childElements; |
13 | 13 |
14 _ChildrenElementList._wrap(Element element) | 14 _ChildrenElementList._wrap(Element element) |
15 : _childElements = element.$dom_children, | 15 : _childElements = element.$dom_children, |
16 _element = element; | 16 _element = element; |
17 | 17 |
18 List<Element> toList({ bool growable: true }) { | 18 List<Element> toList({ bool growable: true }) { |
19 List<Element> output; | 19 List<Element> output; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 bool any(bool f(Element element)) { | 57 bool any(bool f(Element element)) { |
58 for (Element element in this) { | 58 for (Element element in this) { |
59 if (f(element)) { | 59 if (f(element)) { |
60 return true; | 60 return true; |
61 } | 61 } |
62 } | 62 } |
63 return false; | 63 return false; |
64 } | 64 } |
65 | 65 |
66 String join([String separator]) { | 66 String join([String separator]) { |
67 return IterableMixinWorkaround.joinList(this, separator); | 67 return _childElements.join(separator); |
68 } | 68 } |
69 | 69 |
70 Iterable map(f(Element element)) { | 70 Iterable map(f(Element element)) { |
71 return IterableMixinWorkaround.mapList(this, f); | 71 return _childElements.map(f); |
72 } | 72 } |
73 | 73 |
74 Iterable<Element> where(bool f(Element element)) { | 74 Iterable<Element> where(bool f(Element element)) { |
75 return IterableMixinWorkaround.where(this, f); | 75 return _childElements.where(f); |
76 } | 76 } |
77 | 77 |
78 Iterable expand(Iterable f(Element element)) { | 78 Iterable expand(Iterable f(Element element)) { |
79 return IterableMixinWorkaround.expand(this, f); | 79 return _childElements.expand(f); |
80 } | 80 } |
81 | 81 |
82 bool get isEmpty { | 82 bool get isEmpty { |
83 return _element.$dom_firstElementChild == null; | 83 return _element.$dom_firstElementChild == null; |
84 } | 84 } |
85 | 85 |
86 Iterable<Element> take(int n) { | 86 Iterable<Element> take(int n) { |
87 return IterableMixinWorkaround.takeList(this, n); | 87 return IterableMixinWorkaround.takeList(this, n); |
88 } | 88 } |
89 | 89 |
(...skipping 1055 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1145 const ScrollAlignment._internal(this._value); | 1145 const ScrollAlignment._internal(this._value); |
1146 toString() => 'ScrollAlignment.$_value'; | 1146 toString() => 'ScrollAlignment.$_value'; |
1147 | 1147 |
1148 /// Attempt to align the element to the top of the scrollable area. | 1148 /// Attempt to align the element to the top of the scrollable area. |
1149 static const TOP = const ScrollAlignment._internal('TOP'); | 1149 static const TOP = const ScrollAlignment._internal('TOP'); |
1150 /// Attempt to center the element in the scrollable area. | 1150 /// Attempt to center the element in the scrollable area. |
1151 static const CENTER = const ScrollAlignment._internal('CENTER'); | 1151 static const CENTER = const ScrollAlignment._internal('CENTER'); |
1152 /// Attempt to align the element to the bottom of the scrollable area. | 1152 /// Attempt to align the element to the bottom of the scrollable area. |
1153 static const BOTTOM = const ScrollAlignment._internal('BOTTOM'); | 1153 static const BOTTOM = const ScrollAlignment._internal('BOTTOM'); |
1154 } | 1154 } |
OLD | NEW |