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 implements NodeListWrapper { | 8 implements NodeListWrapper { |
9 // Raw Element. | 9 // Raw Element. |
10 final Element _element; | 10 final Element _element; |
(...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
776 get xtag => _xtag != null ? _xtag : this; | 776 get xtag => _xtag != null ? _xtag : this; |
777 | 777 |
778 void set xtag(Element value) { | 778 void set xtag(Element value) { |
779 _xtag = value; | 779 _xtag = value; |
780 } | 780 } |
781 | 781 |
782 @DomName('Element.localName') | 782 @DomName('Element.localName') |
783 @DocsEditable() | 783 @DocsEditable() |
784 String get localName => _localName; | 784 String get localName => _localName; |
785 | 785 |
| 786 /** |
| 787 * A URI that identifies the XML namespace of this element. |
| 788 * |
| 789 * `null` if no namespace URI is specified. |
| 790 * |
| 791 * ## Other resources |
| 792 * |
| 793 * * [Node.namespaceURI] |
| 794 * (http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-NodeNSname) from W3C. |
| 795 */ |
786 @DomName('Element.namespaceUri') | 796 @DomName('Element.namespaceUri') |
787 @DocsEditable() | |
788 String get namespaceUri => _namespaceUri; | 797 String get namespaceUri => _namespaceUri; |
789 | 798 |
790 String toString() => localName; | 799 String toString() => localName; |
791 | 800 |
792 /** | 801 /** |
793 * Scrolls this element into view. | 802 * Scrolls this element into view. |
794 * | 803 * |
795 * Only one of of the alignment options may be specified at a time. | 804 * Only one of of the alignment options may be specified at a time. |
796 * | 805 * |
797 * If no options are specified then this will attempt to scroll the minimum | 806 * If no options are specified then this will attempt to scroll the minimum |
(...skipping 23 matching lines...) Expand all Loading... |
821 this._scrollIntoViewIfNeeded(true); | 830 this._scrollIntoViewIfNeeded(true); |
822 } else { | 831 } else { |
823 this._scrollIntoViewIfNeeded(); | 832 this._scrollIntoViewIfNeeded(); |
824 } | 833 } |
825 } else { | 834 } else { |
826 this._scrollIntoView(); | 835 this._scrollIntoView(); |
827 } | 836 } |
828 } | 837 } |
829 | 838 |
830 $if DART2JS | 839 $if DART2JS |
| 840 /** |
| 841 * Static factory designed to expose `mousewheel` events to event |
| 842 * handlers that are not necessarily instances of [Element]. |
| 843 * |
| 844 * See [EventStreamProvider] for usage information. |
| 845 */ |
831 @DomName('Element.mouseWheelEvent') | 846 @DomName('Element.mouseWheelEvent') |
832 static const EventStreamProvider<WheelEvent> mouseWheelEvent = | 847 static const EventStreamProvider<WheelEvent> mouseWheelEvent = |
833 const _CustomEventStreamProvider<WheelEvent>( | 848 const _CustomEventStreamProvider<WheelEvent>( |
834 Element._determineMouseWheelEventType); | 849 Element._determineMouseWheelEventType); |
835 | 850 |
836 static String _determineMouseWheelEventType(EventTarget e) { | 851 static String _determineMouseWheelEventType(EventTarget e) { |
837 if (JS('bool', '#.onwheel !== undefined', e)) { | 852 if (JS('bool', '#.onwheel !== undefined', e)) { |
838 // W3C spec, and should be IE9+, but IE has a bug exposing onwheel. | 853 // W3C spec, and should be IE9+, but IE has a bug exposing onwheel. |
839 return 'wheel'; | 854 return 'wheel'; |
840 } else if (JS('bool', '#.onmousewheel !== undefined', e)) { | 855 } else if (JS('bool', '#.onmousewheel !== undefined', e)) { |
841 // Chrome & IE | 856 // Chrome & IE |
842 return 'mousewheel'; | 857 return 'mousewheel'; |
843 } else { | 858 } else { |
844 // Firefox | 859 // Firefox |
845 return 'DOMMouseScroll'; | 860 return 'DOMMouseScroll'; |
846 } | 861 } |
847 } | 862 } |
848 | 863 |
| 864 /** |
| 865 * Static factory designed to expose `transitionend` events to event |
| 866 * handlers that are not necessarily instances of [Element]. |
| 867 * |
| 868 * See [EventStreamProvider] for usage information. |
| 869 */ |
849 @DomName('Element.transitionEndEvent') | 870 @DomName('Element.transitionEndEvent') |
850 static const EventStreamProvider<TransitionEvent> transitionEndEvent = | 871 static const EventStreamProvider<TransitionEvent> transitionEndEvent = |
851 const _CustomEventStreamProvider<TransitionEvent>( | 872 const _CustomEventStreamProvider<TransitionEvent>( |
852 Element._determineTransitionEventType); | 873 Element._determineTransitionEventType); |
853 | 874 |
854 static String _determineTransitionEventType(EventTarget e) { | 875 static String _determineTransitionEventType(EventTarget e) { |
855 // Unfortunately the normal 'ontransitionend' style checks don't work here. | 876 // Unfortunately the normal 'ontransitionend' style checks don't work here. |
856 if (Device.isWebKit) { | 877 if (Device.isWebKit) { |
857 return 'webkitTransitionEnd'; | 878 return 'webkitTransitionEnd'; |
858 } else if (Device.isOpera) { | 879 } else if (Device.isOpera) { |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
983 bool matchesWithAncestors(String selectors) { | 1004 bool matchesWithAncestors(String selectors) { |
984 var elem = this; | 1005 var elem = this; |
985 do { | 1006 do { |
986 if (elem.matches(selectors)) return true; | 1007 if (elem.matches(selectors)) return true; |
987 elem = elem.parent; | 1008 elem = elem.parent; |
988 } while(elem != null); | 1009 } while(elem != null); |
989 return false; | 1010 return false; |
990 } | 1011 } |
991 | 1012 |
992 $if DART2JS | 1013 $if DART2JS |
| 1014 /** |
| 1015 * Creates a new shadow root for this shadow host. |
| 1016 * |
| 1017 * ## Other resources |
| 1018 * |
| 1019 * * [Shadow DOM 101] |
| 1020 * (http://www.html5rocks.com/en/tutorials/webcomponents/shadowdom/) |
| 1021 * from HTML5Rocks. |
| 1022 * * [Shadow DOM specification] |
| 1023 * (http://www.w3.org/TR/shadow-dom/) from W3C. |
| 1024 */ |
993 @DomName('Element.createShadowRoot') | 1025 @DomName('Element.createShadowRoot') |
994 @SupportedBrowser(SupportedBrowser.CHROME, '25') | 1026 @SupportedBrowser(SupportedBrowser.CHROME, '25') |
995 @Experimental() | 1027 @Experimental() |
996 ShadowRoot createShadowRoot() { | 1028 ShadowRoot createShadowRoot() { |
997 return JS('ShadowRoot', | 1029 return JS('ShadowRoot', |
998 '(#.createShadowRoot || #.webkitCreateShadowRoot).call(#)', | 1030 '(#.createShadowRoot || #.webkitCreateShadowRoot).call(#)', |
999 this, this, this); | 1031 this, this, this); |
1000 } | 1032 } |
1001 | 1033 |
| 1034 /** |
| 1035 * The shadow root of this shadow host. |
| 1036 * |
| 1037 * ## Other resources |
| 1038 * |
| 1039 * * [Shadow DOM 101] |
| 1040 * (http://www.html5rocks.com/en/tutorials/webcomponents/shadowdom/) |
| 1041 * from HTML5Rocks. |
| 1042 * * [Shadow DOM specification] |
| 1043 * (http://www.w3.org/TR/shadow-dom/) from W3C. |
| 1044 */ |
1002 @DomName('Element.shadowRoot') | 1045 @DomName('Element.shadowRoot') |
1003 @SupportedBrowser(SupportedBrowser.CHROME, '25') | 1046 @SupportedBrowser(SupportedBrowser.CHROME, '25') |
1004 @Experimental() | 1047 @Experimental() |
1005 ShadowRoot get shadowRoot => | 1048 ShadowRoot get shadowRoot => |
1006 JS('ShadowRoot|Null', '#.shadowRoot || #.webkitShadowRoot', this, this); | 1049 JS('ShadowRoot|Null', '#.shadowRoot || #.webkitShadowRoot', this, this); |
1007 $endif | 1050 $endif |
1008 | 1051 |
1009 /** | 1052 /** |
1010 * Access this element's content position. | 1053 * Access this element's content position. |
1011 * | 1054 * |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1289 const ScrollAlignment._internal(this._value); | 1332 const ScrollAlignment._internal(this._value); |
1290 toString() => 'ScrollAlignment.$_value'; | 1333 toString() => 'ScrollAlignment.$_value'; |
1291 | 1334 |
1292 /// Attempt to align the element to the top of the scrollable area. | 1335 /// Attempt to align the element to the top of the scrollable area. |
1293 static const TOP = const ScrollAlignment._internal('TOP'); | 1336 static const TOP = const ScrollAlignment._internal('TOP'); |
1294 /// Attempt to center the element in the scrollable area. | 1337 /// Attempt to center the element in the scrollable area. |
1295 static const CENTER = const ScrollAlignment._internal('CENTER'); | 1338 static const CENTER = const ScrollAlignment._internal('CENTER'); |
1296 /// Attempt to align the element to the bottom of the scrollable area. | 1339 /// Attempt to align the element to the bottom of the scrollable area. |
1297 static const BOTTOM = const ScrollAlignment._internal('BOTTOM'); | 1340 static const BOTTOM = const ScrollAlignment._internal('BOTTOM'); |
1298 } | 1341 } |
OLD | NEW |