| 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 class _ChildrenElementList extends ListBase<Element> { | 7 class _ChildrenElementList extends ListBase<Element> { |
| 8 // Raw Element. | 8 // Raw Element. |
| 9 final Element _element; | 9 final Element _element; |
| 10 final HtmlCollection _childElements; | 10 final HtmlCollection _childElements; |
| (...skipping 861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 872 break; | 872 break; |
| 873 default: | 873 default: |
| 874 throw new ArgumentError("Invalid position ${where}"); | 874 throw new ArgumentError("Invalid position ${where}"); |
| 875 } | 875 } |
| 876 } | 876 } |
| 877 | 877 |
| 878 /** | 878 /** |
| 879 * Checks if this element matches the CSS selectors. | 879 * Checks if this element matches the CSS selectors. |
| 880 */ | 880 */ |
| 881 @Experimental() | 881 @Experimental() |
| 882 bool _matches(String selectors) { | 882 bool matches(String selectors) { |
| 883 if (JS('bool', '!!#.matches', this)) { | 883 if (JS('bool', '!!#.matches', this)) { |
| 884 return JS('bool', '#.matches(#)', this, selectors); | 884 return JS('bool', '#.matches(#)', this, selectors); |
| 885 } else if (JS('bool', '!!#.webkitMatchesSelector', this)) { | 885 } else if (JS('bool', '!!#.webkitMatchesSelector', this)) { |
| 886 return JS('bool', '#.webkitMatchesSelector(#)', this, selectors); | 886 return JS('bool', '#.webkitMatchesSelector(#)', this, selectors); |
| 887 } else if (JS('bool', '!!#.mozMatchesSelector', this)) { | 887 } else if (JS('bool', '!!#.mozMatchesSelector', this)) { |
| 888 return JS('bool', '#.mozMatchesSelector(#)', this, selectors); | 888 return JS('bool', '#.mozMatchesSelector(#)', this, selectors); |
| 889 } else if (JS('bool', '!!#.msMatchesSelector', this)) { | 889 } else if (JS('bool', '!!#.msMatchesSelector', this)) { |
| 890 return matches = JS('bool', '#.msMatchesSelector(#)', this, selectors); | 890 return matches = JS('bool', '#.msMatchesSelector(#)', this, selectors); |
| 891 } else { | 891 } else { |
| 892 throw new UnsupportedError("Not supported on this platform"); | 892 throw new UnsupportedError("Not supported on this platform"); |
| 893 } | 893 } |
| 894 return false; | 894 return false; |
| 895 } | 895 } |
| 896 $else | 896 $else |
| 897 $endif | 897 $endif |
| 898 | 898 |
| 899 /** | 899 /** Checks if this element or any of its parents match the CSS selectors. */ |
| 900 * Checks if this element matches the CSS selectors. | |
| 901 * | |
| 902 * If `includeAncestors` is true, we examine all of this element's parent | |
| 903 * elements and also return true if any of its parent elements matches | |
| 904 * `selectors`. | |
| 905 */ | |
| 906 @Experimental() | 900 @Experimental() |
| 907 bool matches(String selectors, [includeAncestors = false]) { | 901 bool matchesWithAncestors(String selectors) { |
| 908 var elem = this; | 902 var elem = this; |
| 909 do { | 903 do { |
| 910 if (elem._matches(selectors)) return true; | 904 if (elem.matches(selectors)) return true; |
| 911 elem = elem.parent; | 905 elem = elem.parent; |
| 912 } while(includeAncestors && elem != null); | 906 } while(elem != null); |
| 913 return false; | 907 return false; |
| 914 } | 908 } |
| 915 | 909 |
| 916 $if DART2JS | 910 $if DART2JS |
| 917 @Creates('Null') // Set from Dart code; does not instantiate a native type. | 911 @Creates('Null') // Set from Dart code; does not instantiate a native type. |
| 918 $endif | 912 $endif |
| 919 Element _templateInstanceRef; | 913 Element _templateInstanceRef; |
| 920 | 914 |
| 921 // Note: only used if `this is! TemplateElement` | 915 // Note: only used if `this is! TemplateElement` |
| 922 $if DART2JS | 916 $if DART2JS |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1316 const ScrollAlignment._internal(this._value); | 1310 const ScrollAlignment._internal(this._value); |
| 1317 toString() => 'ScrollAlignment.$_value'; | 1311 toString() => 'ScrollAlignment.$_value'; |
| 1318 | 1312 |
| 1319 /// Attempt to align the element to the top of the scrollable area. | 1313 /// Attempt to align the element to the top of the scrollable area. |
| 1320 static const TOP = const ScrollAlignment._internal('TOP'); | 1314 static const TOP = const ScrollAlignment._internal('TOP'); |
| 1321 /// Attempt to center the element in the scrollable area. | 1315 /// Attempt to center the element in the scrollable area. |
| 1322 static const CENTER = const ScrollAlignment._internal('CENTER'); | 1316 static const CENTER = const ScrollAlignment._internal('CENTER'); |
| 1323 /// Attempt to align the element to the bottom of the scrollable area. | 1317 /// Attempt to align the element to the bottom of the scrollable area. |
| 1324 static const BOTTOM = const ScrollAlignment._internal('BOTTOM'); | 1318 static const BOTTOM = const ScrollAlignment._internal('BOTTOM'); |
| 1325 } | 1319 } |
| OLD | NEW |