Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(91)

Side by Side Diff: tools/dom/templates/html/impl/impl_Element.darttemplate

Issue 1894713002: Strong html (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: ptal Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 } 64 }
65 65
66 void removeWhere(bool test(Element element)) { 66 void removeWhere(bool test(Element element)) {
67 _filter(test, false); 67 _filter(test, false);
68 } 68 }
69 69
70 void retainWhere(bool test(Element element)) { 70 void retainWhere(bool test(Element element)) {
71 _filter(test, true); 71 _filter(test, true);
72 } 72 }
73 73
74 void _filter(bool test(var element), bool retainMatching) { 74 void _filter(bool test(Element element), bool retainMatching) {
75 var removed; 75 var removed;
76 if (retainMatching) { 76 if (retainMatching) {
77 removed = _element.children.where((e) => !test(e)); 77 removed = _element.children.where((e) => !test(e));
78 } else { 78 } else {
79 removed = _element.children.where(test); 79 removed = _element.children.where(test);
80 } 80 }
81 for (var e in removed) e.remove(); 81 for (var e in removed) e.remove();
82 } 82 }
83 83
84 void setRange(int start, int end, Iterable<Element> iterable, 84 void setRange(int start, int end, Iterable<Element> iterable,
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 * item.text = 'Something'; 586 * item.text = 'Something';
587 * document.body.children.add(item) // Item is now displayed on the page. 587 * document.body.children.add(item) // Item is now displayed on the page.
588 * for (var element in document.body.children) { 588 * for (var element in document.body.children) {
589 * element.style.background = 'red'; // Turns every child of body red. 589 * element.style.background = 'red'; // Turns every child of body red.
590 * } 590 * }
591 */ 591 */
592 List<Element> get children => new _ChildrenElementList._wrap(this); 592 List<Element> get children => new _ChildrenElementList._wrap(this);
593 593
594 set children(List<Element> value) { 594 set children(List<Element> value) {
595 // Copy list first since we don't want liveness during iteration. 595 // Copy list first since we don't want liveness during iteration.
596 List copy = new List.from(value); 596 var copy = value.toList();
597 var children = this.children; 597 var children = this.children;
598 children.clear(); 598 children.clear();
599 children.addAll(copy); 599 children.addAll(copy);
600 } 600 }
601 601
602 /** 602 /**
603 * Finds all descendent elements of this element that match the specified 603 * Finds all descendent elements of this element that match the specified
604 * group of selectors. 604 * group of selectors.
605 * 605 *
606 * [selectors] should be a string using CSS selector syntax. 606 * [selectors] should be a string using CSS selector syntax.
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
821 * for the transition, or a Map with fields corresponding to those 821 * for the transition, or a Map with fields corresponding to those
822 * of the [Timing] object. 822 * of the [Timing] object.
823 **/ 823 **/
824 @Experimental() 824 @Experimental()
825 @SupportedBrowser(SupportedBrowser.CHROME, '36') 825 @SupportedBrowser(SupportedBrowser.CHROME, '36')
826 Animation animate(Iterable<Map<String, dynamic>> frames, [timing]) { 826 Animation animate(Iterable<Map<String, dynamic>> frames, [timing]) {
827 if (frames is! Iterable || !(frames.every((x) => x is Map))) { 827 if (frames is! Iterable || !(frames.every((x) => x is Map))) {
828 throw new ArgumentError("The frames parameter should be a List of Maps " 828 throw new ArgumentError("The frames parameter should be a List of Maps "
829 "with frame information"); 829 "with frame information");
830 } 830 }
831 var convertedFrames = frames; 831 var convertedFrames;
832 if (convertedFrames is Iterable) { 832 if (frames is Iterable) {
833 $if DART2JS 833 $if DART2JS
834 convertedFrames = frames.map(convertDartToNative_Dictionary).toList(); 834 convertedFrames = frames.map(convertDartToNative_Dictionary).toList();
835 $else 835 $else
836 convertedFrames = convertDartToNative_List( 836 convertedFrames = convertDartToNative_List(
837 frames.map(convertDartToNative_Dictionary).toList()); 837 frames.map(convertDartToNative_Dictionary).toList());
838 $endif 838 $endif
839 } else {
840 convertedFrames = frames;
839 } 841 }
840 var convertedTiming = timing; 842 var convertedTiming = timing is Map ? convertDartToNative_Dictionary(timing) : timing;
841 if (convertedTiming is Map) {
842 convertedTiming = convertDartToNative_Dictionary(convertedTiming);
843 }
844 return convertedTiming == null 843 return convertedTiming == null
845 ? _animate(convertedFrames) 844 ? _animate(convertedFrames)
846 : _animate(convertedFrames, convertedTiming); 845 : _animate(convertedFrames, convertedTiming);
847 } 846 }
848 847
849 $if DART2JS 848 $if DART2JS
850 @DomName('Element.animate') 849 @DomName('Element.animate')
851 @JSName('animate') 850 @JSName('animate')
852 @Experimental() // untriaged 851 @Experimental() // untriaged
853 Animation _animate(Object effect, [timing]) native; 852 Animation _animate(Object effect, [timing]) native;
(...skipping 816 matching lines...) Expand 10 before | Expand all | Expand 10 after
1670 const ScrollAlignment._internal(this._value); 1669 const ScrollAlignment._internal(this._value);
1671 toString() => 'ScrollAlignment.$_value'; 1670 toString() => 'ScrollAlignment.$_value';
1672 1671
1673 /// Attempt to align the element to the top of the scrollable area. 1672 /// Attempt to align the element to the top of the scrollable area.
1674 static const TOP = const ScrollAlignment._internal('TOP'); 1673 static const TOP = const ScrollAlignment._internal('TOP');
1675 /// Attempt to center the element in the scrollable area. 1674 /// Attempt to center the element in the scrollable area.
1676 static const CENTER = const ScrollAlignment._internal('CENTER'); 1675 static const CENTER = const ScrollAlignment._internal('CENTER');
1677 /// Attempt to align the element to the bottom of the scrollable area. 1676 /// Attempt to align the element to the bottom of the scrollable area.
1678 static const BOTTOM = const ScrollAlignment._internal('BOTTOM'); 1677 static const BOTTOM = const ScrollAlignment._internal('BOTTOM');
1679 } 1678 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698