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 856 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
867 case 'beforeend': | 867 case 'beforeend': |
868 this.append(node); | 868 this.append(node); |
869 break; | 869 break; |
870 case 'afterend': | 870 case 'afterend': |
871 this.parentNode.insertBefore(node, this.nextNode); | 871 this.parentNode.insertBefore(node, this.nextNode); |
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 $endif | |
878 | 877 |
879 /** | 878 /** |
880 * Checks if this element matches the CSS selectors. | 879 * Checks if this element matches the CSS selectors. |
881 * | 880 * |
882 * If `includeAncestors` is true, we examine all of this element's parent | 881 * If `includeAncestors` is true, we examine all of this element's parent |
883 * elements and also return true if any of its parent elements matches | 882 * elements and also return true if any of its parent elements matches |
884 * `selectors`. | 883 * `selectors`. |
885 */ | 884 */ |
886 @Experimental() | 885 @Experimental() |
887 bool matches(String selectors, [includeAncestors = false]) { | 886 bool matches(String selectors, [includeAncestors = false]) { |
888 var elem = this; | 887 var elem = this; |
889 do { | 888 do { |
890 bool matches = false; | 889 bool matches = false; |
891 if (JS('bool', '!!#.matches', elem)) { | 890 if (JS('bool', '!!#.matches', elem)) { |
892 matches = JS('bool', '#.matches(#)', elem, selectors); | 891 matches = JS('bool', '#.matches(#)', elem, selectors); |
893 } else if (JS('bool', '!!#.webkitMatchesSelector', elem)) { | 892 } else if (JS('bool', '!!#.webkitMatchesSelector', elem)) { |
894 matches = JS('bool', '#.webkitMatchesSelector(#)', elem, selectors); | 893 matches = JS('bool', '#.webkitMatchesSelector(#)', elem, selectors); |
895 } else if (JS('bool', '!!#.mozMatchesSelector', elem)) { | 894 } else if (JS('bool', '!!#.mozMatchesSelector', elem)) { |
896 matches = JS('bool', '#.mozMatchesSelector(#)', elem, selectors); | 895 matches = JS('bool', '#.mozMatchesSelector(#)', elem, selectors); |
897 } else if (JS('bool', '!!#.msMatchesSelector', elem)) { | 896 } else if (JS('bool', '!!#.msMatchesSelector', elem)) { |
898 matches = JS('bool', '#.msMatchesSelector(#)', elem, selectors); | 897 matches = JS('bool', '#.msMatchesSelector(#)', elem, selectors); |
899 } else { | 898 } else { |
900 throw new UnsupportedError("Not supported on this platform"); | 899 throw new UnsupportedError("Not supported on this platform"); |
901 } | 900 } |
902 if (matches) return true; | 901 if (matches) return true; |
903 elem = elem.parent; | 902 elem = elem.parent; |
904 } while(includeAncestors && elem != null); | 903 } while(includeAncestors && elem != null); |
905 return false; | 904 return false; |
906 } | 905 } |
| 906 $else |
| 907 $endif |
907 | 908 |
908 $if DART2JS | 909 $if DART2JS |
909 @Creates('Null') // Set from Dart code; does not instantiate a native type. | 910 @Creates('Null') // Set from Dart code; does not instantiate a native type. |
910 $endif | 911 $endif |
911 Element _templateInstanceRef; | 912 Element _templateInstanceRef; |
912 | 913 |
913 // Note: only used if `this is! TemplateElement` | 914 // Note: only used if `this is! TemplateElement` |
914 $if DART2JS | 915 $if DART2JS |
915 @Creates('Null') // Set from Dart code; does not instantiate a native type. | 916 @Creates('Null') // Set from Dart code; does not instantiate a native type. |
916 $endif | 917 $endif |
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1308 const ScrollAlignment._internal(this._value); | 1309 const ScrollAlignment._internal(this._value); |
1309 toString() => 'ScrollAlignment.$_value'; | 1310 toString() => 'ScrollAlignment.$_value'; |
1310 | 1311 |
1311 /// Attempt to align the element to the top of the scrollable area. | 1312 /// Attempt to align the element to the top of the scrollable area. |
1312 static const TOP = const ScrollAlignment._internal('TOP'); | 1313 static const TOP = const ScrollAlignment._internal('TOP'); |
1313 /// Attempt to center the element in the scrollable area. | 1314 /// Attempt to center the element in the scrollable area. |
1314 static const CENTER = const ScrollAlignment._internal('CENTER'); | 1315 static const CENTER = const ScrollAlignment._internal('CENTER'); |
1315 /// Attempt to align the element to the bottom of the scrollable area. | 1316 /// Attempt to align the element to the bottom of the scrollable area. |
1316 static const BOTTOM = const ScrollAlignment._internal('BOTTOM'); | 1317 static const BOTTOM = const ScrollAlignment._internal('BOTTOM'); |
1317 } | 1318 } |
OLD | NEW |