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

Side by Side Diff: pkg/third_party/html5lib/lib/dom.dart

Issue 331833003: Revert "Add "last" setter to List." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « pkg/pkgbuild.status ('k') | pkg/third_party/html5lib/lib/src/list_proxy.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /// A simple tree API that results from parsing html. Intended to be compatible 1 /// A simple tree API that results from parsing html. Intended to be compatible
2 /// with dart:html, but it is missing many types and APIs. 2 /// with dart:html, but it is missing many types and APIs.
3 library dom; 3 library dom;
4 4
5 // TODO(jmesserly): lots to do here. Originally I wanted to generate this using 5 // TODO(jmesserly): lots to do here. Originally I wanted to generate this using
6 // our Blink IDL generator, but another idea is to directly use the excellent 6 // our Blink IDL generator, but another idea is to directly use the excellent
7 // http://dom.spec.whatwg.org/ and http://html.spec.whatwg.org/ and just 7 // http://dom.spec.whatwg.org/ and http://html.spec.whatwg.org/ and just
8 // implement that. 8 // implement that.
9 9
10 import 'dart:collection'; 10 import 'dart:collection';
(...skipping 834 matching lines...) Expand 10 before | Expand all | Expand 10 after
845 new List<Element>.from(_childNodes.where((n) => n is Element)); 845 new List<Element>.from(_childNodes.where((n) => n is Element));
846 846
847 void forEach(void f(Element element)) { 847 void forEach(void f(Element element)) {
848 _filtered.forEach(f); 848 _filtered.forEach(f);
849 } 849 }
850 850
851 void operator []=(int index, Element value) { 851 void operator []=(int index, Element value) {
852 this[index].replaceWith(value); 852 this[index].replaceWith(value);
853 } 853 }
854 854
855 void set last(Element value) {
856 this.last.replaceWith(value);
857 }
858
859 void set length(int newLength) { 855 void set length(int newLength) {
860 final len = this.length; 856 final len = this.length;
861 if (newLength >= len) { 857 if (newLength >= len) {
862 return; 858 return;
863 } else if (newLength < 0) { 859 } else if (newLength < 0) {
864 throw new ArgumentError("Invalid list length"); 860 throw new ArgumentError("Invalid list length");
865 } 861 }
866 862
867 removeRange(newLength, len); 863 removeRange(newLength, len);
868 } 864 }
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
1015 1011
1016 class _ConcatTextVisitor extends TreeVisitor { 1012 class _ConcatTextVisitor extends TreeVisitor {
1017 final _str = new StringBuffer(); 1013 final _str = new StringBuffer();
1018 1014
1019 String toString() => _str.toString(); 1015 String toString() => _str.toString();
1020 1016
1021 visitText(Text node) { 1017 visitText(Text node) {
1022 _str.write(node.data); 1018 _str.write(node.data);
1023 } 1019 }
1024 } 1020 }
OLDNEW
« no previous file with comments | « pkg/pkgbuild.status ('k') | pkg/third_party/html5lib/lib/src/list_proxy.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698