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 { |
10 // Raw Element. | 10 // Raw Element. |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 return IterableMixinWorkaround.min(this, compare); | 275 return IterableMixinWorkaround.min(this, compare); |
276 } | 276 } |
277 | 277 |
278 Element max([int compare(Element a, Element b)]) { | 278 Element max([int compare(Element a, Element b)]) { |
279 return IterableMixinWorkaround.max(this, compare); | 279 return IterableMixinWorkaround.max(this, compare); |
280 } | 280 } |
281 | 281 |
282 Map<int, Element> asMap() { | 282 Map<int, Element> asMap() { |
283 return IterableMixinWorkaround.asMapList(this); | 283 return IterableMixinWorkaround.asMapList(this); |
284 } | 284 } |
| 285 |
| 286 String toString() { |
| 287 StringBuffer buffer = new StringBuffer('['); |
| 288 buffer.writeAll(this, ', '); |
| 289 buffer.write(']'); |
| 290 return buffer.toString(); |
| 291 } |
285 } | 292 } |
286 | 293 |
287 // TODO(jacobr): this is an inefficient implementation but it is hard to see | 294 // TODO(jacobr): this is an inefficient implementation but it is hard to see |
288 // a better option given that we cannot quite force NodeList to be an | 295 // a better option given that we cannot quite force NodeList to be an |
289 // ElementList as there are valid cases where a NodeList JavaScript object | 296 // ElementList as there are valid cases where a NodeList JavaScript object |
290 // contains Node objects that are not Elements. | 297 // contains Node objects that are not Elements. |
291 class _FrozenElementList implements List { | 298 class _FrozenElementList implements List { |
292 final List<Node> _nodeList; | 299 final List<Node> _nodeList; |
293 | 300 |
294 _FrozenElementList._wrap(this._nodeList); | 301 _FrozenElementList._wrap(this._nodeList); |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 return IterableMixinWorkaround.min(this, compare); | 492 return IterableMixinWorkaround.min(this, compare); |
486 } | 493 } |
487 | 494 |
488 Element max([int compare(Element a, Element b)]) { | 495 Element max([int compare(Element a, Element b)]) { |
489 return IterableMixinWorkaround.max(this, compare); | 496 return IterableMixinWorkaround.max(this, compare); |
490 } | 497 } |
491 | 498 |
492 Map<int, Element> asMap() { | 499 Map<int, Element> asMap() { |
493 return IterableMixinWorkaround.asMapList(this); | 500 return IterableMixinWorkaround.asMapList(this); |
494 } | 501 } |
| 502 |
| 503 String toString() { |
| 504 StringBuffer buffer = new StringBuffer('['); |
| 505 buffer.writeAll(this, ', '); |
| 506 buffer.write(']'); |
| 507 return buffer.toString(); |
| 508 } |
495 } | 509 } |
496 | 510 |
497 class _FrozenElementListIterator implements Iterator<Element> { | 511 class _FrozenElementListIterator implements Iterator<Element> { |
498 final _FrozenElementList _list; | 512 final _FrozenElementList _list; |
499 int _index = -1; | 513 int _index = -1; |
500 Element _current; | 514 Element _current; |
501 | 515 |
502 _FrozenElementListIterator(this._list); | 516 _FrozenElementListIterator(this._list); |
503 | 517 |
504 /** | 518 /** |
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
972 } else if (JS('bool', '!!#.mozMatchesSelector', this)) { | 986 } else if (JS('bool', '!!#.mozMatchesSelector', this)) { |
973 return JS('bool', '#.mozMatchesSelector(#)', this, selectors); | 987 return JS('bool', '#.mozMatchesSelector(#)', this, selectors); |
974 } else if (JS('bool', '!!#.msMatchesSelector', this)) { | 988 } else if (JS('bool', '!!#.msMatchesSelector', this)) { |
975 return JS('bool', '#.msMatchesSelector(#)', this, selectors); | 989 return JS('bool', '#.msMatchesSelector(#)', this, selectors); |
976 } | 990 } |
977 throw new UnsupportedError("Not supported on this platform"); | 991 throw new UnsupportedError("Not supported on this platform"); |
978 } | 992 } |
979 $else | 993 $else |
980 $endif | 994 $endif |
981 | 995 |
| 996 /** |
| 997 * Print out a String representation of this Element. By default, this is |
| 998 * this Element's tagName. |
| 999 */ |
| 1000 String toString() => this.tagName; |
| 1001 |
982 $!MEMBERS | 1002 $!MEMBERS |
983 } | 1003 } |
984 | 1004 |
985 final _START_TAG_REGEXP = new RegExp('<(\\w+)'); | 1005 final _START_TAG_REGEXP = new RegExp('<(\\w+)'); |
986 class _ElementFactoryProvider { | 1006 class _ElementFactoryProvider { |
987 static const _CUSTOM_PARENT_TAG_MAP = const { | 1007 static const _CUSTOM_PARENT_TAG_MAP = const { |
988 'body' : 'html', | 1008 'body' : 'html', |
989 'head' : 'html', | 1009 'head' : 'html', |
990 'caption' : 'table', | 1010 'caption' : 'table', |
991 'td': 'tr', | 1011 'td': 'tr', |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1131 const ScrollAlignment._internal(this._value); | 1151 const ScrollAlignment._internal(this._value); |
1132 toString() => 'ScrollAlignment.$_value'; | 1152 toString() => 'ScrollAlignment.$_value'; |
1133 | 1153 |
1134 /// Attempt to align the element to the top of the scrollable area. | 1154 /// Attempt to align the element to the top of the scrollable area. |
1135 static const TOP = const ScrollAlignment._internal('TOP'); | 1155 static const TOP = const ScrollAlignment._internal('TOP'); |
1136 /// Attempt to center the element in the scrollable area. | 1156 /// Attempt to center the element in the scrollable area. |
1137 static const CENTER = const ScrollAlignment._internal('CENTER'); | 1157 static const CENTER = const ScrollAlignment._internal('CENTER'); |
1138 /// Attempt to align the element to the bottom of the scrollable area. | 1158 /// Attempt to align the element to the bottom of the scrollable area. |
1139 static const BOTTOM = const ScrollAlignment._internal('BOTTOM'); | 1159 static const BOTTOM = const ScrollAlignment._internal('BOTTOM'); |
1140 } | 1160 } |
OLD | NEW |