OLD | NEW |
---|---|
1 library html; | 1 library html; |
2 | 2 |
3 import 'dart:isolate'; | 3 import 'dart:isolate'; |
4 import 'dart:json'; | 4 import 'dart:json'; |
5 import 'dart:svg' as svg; | 5 import 'dart:svg' as svg; |
6 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 6 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
7 // for details. All rights reserved. Use of this source code is governed by a | 7 // for details. All rights reserved. Use of this source code is governed by a |
8 // BSD-style license that can be found in the LICENSE file. | 8 // BSD-style license that can be found in the LICENSE file. |
9 | 9 |
10 // DO NOT EDIT | 10 // DO NOT EDIT |
(...skipping 6769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6780 factory DocumentFragment() => _DocumentFragmentFactoryProvider.createDocumentF ragment(); | 6780 factory DocumentFragment() => _DocumentFragmentFactoryProvider.createDocumentF ragment(); |
6781 | 6781 |
6782 factory DocumentFragment.html(String html) => | 6782 factory DocumentFragment.html(String html) => |
6783 _DocumentFragmentFactoryProvider.createDocumentFragment_html(html); | 6783 _DocumentFragmentFactoryProvider.createDocumentFragment_html(html); |
6784 | 6784 |
6785 factory DocumentFragment.svg(String svgContent) => | 6785 factory DocumentFragment.svg(String svgContent) => |
6786 _DocumentFragmentFactoryProvider.createDocumentFragment_svg(svgContent); | 6786 _DocumentFragmentFactoryProvider.createDocumentFragment_svg(svgContent); |
6787 | 6787 |
6788 List<Element> _elements; | 6788 List<Element> _elements; |
6789 | 6789 |
6790 List<Element> get elements { | 6790 List<Element> get elements { |
sra1
2012/11/19 19:34:53
get elements => this.children'
blois
2012/11/19 21:57:49
Done.
| |
6791 if (_elements == null) { | 6791 if (_elements == null) { |
6792 _elements = new FilteredElementList(this); | 6792 _elements = new FilteredElementList(this); |
6793 } | 6793 } |
6794 return _elements; | 6794 return _elements; |
6795 } | 6795 } |
6796 | 6796 |
6797 // TODO: The type of value should be Collection<Element>. See http://b/5392897 | 6797 // TODO: The type of value should be Collection<Element>. See http://b/5392897 |
6798 void set elements(value) { | 6798 void set elements(value) { |
sra1
2012/11/19 19:34:53
set elements(value) { this.children = value; }
blois
2012/11/19 21:57:49
Done.
| |
6799 // Copy list first since we don't want liveness during iteration. | 6799 // Copy list first since we don't want liveness during iteration. |
6800 List copy = new List.from(value); | 6800 List copy = new List.from(value); |
6801 final elements = this.elements; | 6801 final elements = this.elements; |
6802 elements.clear(); | 6802 elements.clear(); |
6803 elements.addAll(copy); | 6803 elements.addAll(copy); |
6804 } | 6804 } |
6805 | 6805 |
6806 List<Element> _children; | |
sra1
2012/11/19 19:34:53
_children needs an annotation:
@Creates('Null')
blois
2012/11/19 21:57:49
Done.
| |
6807 List<Element> get children { | |
6808 if (_children == null) { | |
6809 _children = new FilteredElementList(this); | |
6810 } | |
6811 return _children; | |
6812 } | |
6813 | |
6814 void set children(Collection<Element> value) { | |
6815 final children = this.children; | |
sra1
2012/11/19 19:34:53
This is not the same set elements
x.children = x.
blois
2012/11/19 21:57:49
Done.
| |
6816 children.clear(); | |
6817 children.addAll(value); | |
6818 } | |
6819 | |
6806 Element query(String selectors) => $dom_querySelector(selectors); | 6820 Element query(String selectors) => $dom_querySelector(selectors); |
6807 | 6821 |
6808 List<Element> queryAll(String selectors) => | 6822 List<Element> queryAll(String selectors) => |
6809 new _FrozenElementList._wrap($dom_querySelectorAll(selectors)); | 6823 new _FrozenElementList._wrap($dom_querySelectorAll(selectors)); |
6810 | 6824 |
6811 String get innerHTML { | 6825 String get innerHTML { |
6812 final e = new Element.tag("div"); | 6826 final e = new Element.tag("div"); |
6813 e.nodes.add(this.clone(true)); | 6827 e.nodes.add(this.clone(true)); |
6814 return e.innerHTML; | 6828 return e.innerHTML; |
6815 } | 6829 } |
(...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7620 } | 7634 } |
7621 } | 7635 } |
7622 | 7636 |
7623 void set elements(Collection<Element> value) { | 7637 void set elements(Collection<Element> value) { |
7624 final elements = this.elements; | 7638 final elements = this.elements; |
7625 elements.clear(); | 7639 elements.clear(); |
7626 elements.addAll(value); | 7640 elements.addAll(value); |
7627 } | 7641 } |
7628 | 7642 |
7629 /** | 7643 /** |
7644 * Deprecated, use [children] instead. | |
7645 */ | |
7646 List<Element> get elements => new _ChildrenElementList._wrap(this); | |
sra1
2012/11/19 19:34:53
I would write this as => this.children
blois
2012/11/19 21:57:49
Done.
| |
7647 | |
7648 /** | |
7630 * @domName childElementCount, firstElementChild, lastElementChild, | 7649 * @domName childElementCount, firstElementChild, lastElementChild, |
7631 * children, Node.nodes.add | 7650 * children, Node.nodes.add |
7632 */ | 7651 */ |
7633 List<Element> get elements => new _ChildrenElementList._wrap(this); | 7652 List<Element> get children => new _ChildrenElementList._wrap(this); |
7653 | |
7654 void set children(Collection<Element> value) { | |
7655 var children = this.children; | |
7656 children.clear(); | |
7657 children.addAll(value); | |
7658 } | |
7634 | 7659 |
7635 Element query(String selectors) => $dom_querySelector(selectors); | 7660 Element query(String selectors) => $dom_querySelector(selectors); |
7636 | 7661 |
7637 List<Element> queryAll(String selectors) => | 7662 List<Element> queryAll(String selectors) => |
7638 new _FrozenElementList._wrap($dom_querySelectorAll(selectors)); | 7663 new _FrozenElementList._wrap($dom_querySelectorAll(selectors)); |
7639 | 7664 |
7640 /** @domName className, classList */ | 7665 /** @domName className, classList */ |
7641 CssClassSet get classes => new _ElementCssClassSet(this); | 7666 CssClassSet get classes => new _ElementCssClassSet(this); |
7642 | 7667 |
7643 void set classes(Collection<String> value) { | 7668 void set classes(Collection<String> value) { |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7977 if (match != null) { | 8002 if (match != null) { |
7978 tag = match.group(1).toLowerCase(); | 8003 tag = match.group(1).toLowerCase(); |
7979 if (_CUSTOM_PARENT_TAG_MAP.containsKey(tag)) { | 8004 if (_CUSTOM_PARENT_TAG_MAP.containsKey(tag)) { |
7980 parentTag = _CUSTOM_PARENT_TAG_MAP[tag]; | 8005 parentTag = _CUSTOM_PARENT_TAG_MAP[tag]; |
7981 } | 8006 } |
7982 } | 8007 } |
7983 final Element temp = new Element.tag(parentTag); | 8008 final Element temp = new Element.tag(parentTag); |
7984 temp.innerHTML = html; | 8009 temp.innerHTML = html; |
7985 | 8010 |
7986 Element element; | 8011 Element element; |
7987 if (temp.elements.length == 1) { | 8012 if (temp.children.length == 1) { |
7988 element = temp.elements[0]; | 8013 element = temp.children[0]; |
7989 } else if (parentTag == 'html' && temp.elements.length == 2) { | 8014 } else if (parentTag == 'html' && temp.children.length == 2) { |
7990 // Work around for edge case in WebKit and possibly other browsers where | 8015 // Work around for edge case in WebKit and possibly other browsers where |
7991 // both body and head elements are created even though the inner html | 8016 // both body and head elements are created even though the inner html |
7992 // only contains a head or body element. | 8017 // only contains a head or body element. |
7993 element = temp.elements[tag == 'head' ? 0 : 1]; | 8018 element = temp.children[tag == 'head' ? 0 : 1]; |
7994 } else { | 8019 } else { |
7995 throw new ArgumentError('HTML had ${temp.elements.length} ' | 8020 throw new ArgumentError('HTML had ${temp.children.length} ' |
7996 'top level elements but 1 expected'); | 8021 'top level elements but 1 expected'); |
7997 } | 8022 } |
7998 element.remove(); | 8023 element.remove(); |
7999 return element; | 8024 return element; |
8000 } | 8025 } |
8001 | 8026 |
8002 /** @domName Document.createElement */ | 8027 /** @domName Document.createElement */ |
8003 // Optimization to improve performance until the dart2js compiler inlines this | 8028 // Optimization to improve performance until the dart2js compiler inlines this |
8004 // method. | 8029 // method. |
8005 static Element createElement_tag(String tag) => | 8030 static Element createElement_tag(String tag) => |
(...skipping 949 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8955 factory Float32Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int lengt h]) => | 8980 factory Float32Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int lengt h]) => |
8956 _TypedArrayFactoryProvider.createFloat32Array_fromBuffer(buffer, byteOffset, length); | 8981 _TypedArrayFactoryProvider.createFloat32Array_fromBuffer(buffer, byteOffset, length); |
8957 | 8982 |
8958 static const int BYTES_PER_ELEMENT = 4; | 8983 static const int BYTES_PER_ELEMENT = 4; |
8959 | 8984 |
8960 /** @domName Float32Array.length */ | 8985 /** @domName Float32Array.length */ |
8961 final int length; | 8986 final int length; |
8962 | 8987 |
8963 num operator[](int index) => JS("num", "#[#]", this, index); | 8988 num operator[](int index) => JS("num", "#[#]", this, index); |
8964 | 8989 |
8965 void operator[]=(int index, num value) { JS("void", "#[#] = #", this, index, v alue); } | 8990 void operator[]=(int index, num value) { JS("void", "#[#] = #", this, index, v alue); } // -- start List<num> mixins. |
8966 // -- start List<num> mixins. | |
8967 // num is the element type. | 8991 // num is the element type. |
8968 | 8992 |
8969 // From Iterable<num>: | 8993 // From Iterable<num>: |
8970 | 8994 |
8971 Iterator<num> iterator() { | 8995 Iterator<num> iterator() { |
8972 // Note: NodeLists are not fixed size. And most probably length shouldn't | 8996 // Note: NodeLists are not fixed size. And most probably length shouldn't |
8973 // be cached in both iterator _and_ forEach method. For now caching it | 8997 // be cached in both iterator _and_ forEach method. For now caching it |
8974 // for consistency. | 8998 // for consistency. |
8975 return new FixedSizeListIterator<num>(this); | 8999 return new FixedSizeListIterator<num>(this); |
8976 } | 9000 } |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
9066 factory Float64Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int lengt h]) => | 9090 factory Float64Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int lengt h]) => |
9067 _TypedArrayFactoryProvider.createFloat64Array_fromBuffer(buffer, byteOffset, length); | 9091 _TypedArrayFactoryProvider.createFloat64Array_fromBuffer(buffer, byteOffset, length); |
9068 | 9092 |
9069 static const int BYTES_PER_ELEMENT = 8; | 9093 static const int BYTES_PER_ELEMENT = 8; |
9070 | 9094 |
9071 /** @domName Float64Array.length */ | 9095 /** @domName Float64Array.length */ |
9072 final int length; | 9096 final int length; |
9073 | 9097 |
9074 num operator[](int index) => JS("num", "#[#]", this, index); | 9098 num operator[](int index) => JS("num", "#[#]", this, index); |
9075 | 9099 |
9076 void operator[]=(int index, num value) { JS("void", "#[#] = #", this, index, v alue); } | 9100 void operator[]=(int index, num value) { JS("void", "#[#] = #", this, index, v alue); } // -- start List<num> mixins. |
9077 // -- start List<num> mixins. | |
9078 // num is the element type. | 9101 // num is the element type. |
9079 | 9102 |
9080 // From Iterable<num>: | 9103 // From Iterable<num>: |
9081 | 9104 |
9082 Iterator<num> iterator() { | 9105 Iterator<num> iterator() { |
9083 // Note: NodeLists are not fixed size. And most probably length shouldn't | 9106 // Note: NodeLists are not fixed size. And most probably length shouldn't |
9084 // be cached in both iterator _and_ forEach method. For now caching it | 9107 // be cached in both iterator _and_ forEach method. For now caching it |
9085 // for consistency. | 9108 // for consistency. |
9086 return new FixedSizeListIterator<num>(this); | 9109 return new FixedSizeListIterator<num>(this); |
9087 } | 9110 } |
(...skipping 2099 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
11187 factory Int16Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length] ) => | 11210 factory Int16Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length] ) => |
11188 _TypedArrayFactoryProvider.createInt16Array_fromBuffer(buffer, byteOffset, l ength); | 11211 _TypedArrayFactoryProvider.createInt16Array_fromBuffer(buffer, byteOffset, l ength); |
11189 | 11212 |
11190 static const int BYTES_PER_ELEMENT = 2; | 11213 static const int BYTES_PER_ELEMENT = 2; |
11191 | 11214 |
11192 /** @domName Int16Array.length */ | 11215 /** @domName Int16Array.length */ |
11193 final int length; | 11216 final int length; |
11194 | 11217 |
11195 int operator[](int index) => JS("int", "#[#]", this, index); | 11218 int operator[](int index) => JS("int", "#[#]", this, index); |
11196 | 11219 |
11197 void operator[]=(int index, int value) { JS("void", "#[#] = #", this, index, v alue); } | 11220 void operator[]=(int index, int value) { JS("void", "#[#] = #", this, index, v alue); } // -- start List<int> mixins. |
11198 // -- start List<int> mixins. | |
11199 // int is the element type. | 11221 // int is the element type. |
11200 | 11222 |
11201 // From Iterable<int>: | 11223 // From Iterable<int>: |
11202 | 11224 |
11203 Iterator<int> iterator() { | 11225 Iterator<int> iterator() { |
11204 // Note: NodeLists are not fixed size. And most probably length shouldn't | 11226 // Note: NodeLists are not fixed size. And most probably length shouldn't |
11205 // be cached in both iterator _and_ forEach method. For now caching it | 11227 // be cached in both iterator _and_ forEach method. For now caching it |
11206 // for consistency. | 11228 // for consistency. |
11207 return new FixedSizeListIterator<int>(this); | 11229 return new FixedSizeListIterator<int>(this); |
11208 } | 11230 } |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
11298 factory Int32Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length] ) => | 11320 factory Int32Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length] ) => |
11299 _TypedArrayFactoryProvider.createInt32Array_fromBuffer(buffer, byteOffset, l ength); | 11321 _TypedArrayFactoryProvider.createInt32Array_fromBuffer(buffer, byteOffset, l ength); |
11300 | 11322 |
11301 static const int BYTES_PER_ELEMENT = 4; | 11323 static const int BYTES_PER_ELEMENT = 4; |
11302 | 11324 |
11303 /** @domName Int32Array.length */ | 11325 /** @domName Int32Array.length */ |
11304 final int length; | 11326 final int length; |
11305 | 11327 |
11306 int operator[](int index) => JS("int", "#[#]", this, index); | 11328 int operator[](int index) => JS("int", "#[#]", this, index); |
11307 | 11329 |
11308 void operator[]=(int index, int value) { JS("void", "#[#] = #", this, index, v alue); } | 11330 void operator[]=(int index, int value) { JS("void", "#[#] = #", this, index, v alue); } // -- start List<int> mixins. |
11309 // -- start List<int> mixins. | |
11310 // int is the element type. | 11331 // int is the element type. |
11311 | 11332 |
11312 // From Iterable<int>: | 11333 // From Iterable<int>: |
11313 | 11334 |
11314 Iterator<int> iterator() { | 11335 Iterator<int> iterator() { |
11315 // Note: NodeLists are not fixed size. And most probably length shouldn't | 11336 // Note: NodeLists are not fixed size. And most probably length shouldn't |
11316 // be cached in both iterator _and_ forEach method. For now caching it | 11337 // be cached in both iterator _and_ forEach method. For now caching it |
11317 // for consistency. | 11338 // for consistency. |
11318 return new FixedSizeListIterator<int>(this); | 11339 return new FixedSizeListIterator<int>(this); |
11319 } | 11340 } |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
11409 factory Int8Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length]) => | 11430 factory Int8Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length]) => |
11410 _TypedArrayFactoryProvider.createInt8Array_fromBuffer(buffer, byteOffset, le ngth); | 11431 _TypedArrayFactoryProvider.createInt8Array_fromBuffer(buffer, byteOffset, le ngth); |
11411 | 11432 |
11412 static const int BYTES_PER_ELEMENT = 1; | 11433 static const int BYTES_PER_ELEMENT = 1; |
11413 | 11434 |
11414 /** @domName Int8Array.length */ | 11435 /** @domName Int8Array.length */ |
11415 final int length; | 11436 final int length; |
11416 | 11437 |
11417 int operator[](int index) => JS("int", "#[#]", this, index); | 11438 int operator[](int index) => JS("int", "#[#]", this, index); |
11418 | 11439 |
11419 void operator[]=(int index, int value) { JS("void", "#[#] = #", this, index, v alue); } | 11440 void operator[]=(int index, int value) { JS("void", "#[#] = #", this, index, v alue); } // -- start List<int> mixins. |
11420 // -- start List<int> mixins. | |
11421 // int is the element type. | 11441 // int is the element type. |
11422 | 11442 |
11423 // From Iterable<int>: | 11443 // From Iterable<int>: |
11424 | 11444 |
11425 Iterator<int> iterator() { | 11445 Iterator<int> iterator() { |
11426 // Note: NodeLists are not fixed size. And most probably length shouldn't | 11446 // Note: NodeLists are not fixed size. And most probably length shouldn't |
11427 // be cached in both iterator _and_ forEach method. For now caching it | 11447 // be cached in both iterator _and_ forEach method. For now caching it |
11428 // for consistency. | 11448 // for consistency. |
11429 return new FixedSizeListIterator<int>(this); | 11449 return new FixedSizeListIterator<int>(this); |
11430 } | 11450 } |
(...skipping 6558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
17989 factory Uint16Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length ]) => | 18009 factory Uint16Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length ]) => |
17990 _TypedArrayFactoryProvider.createUint16Array_fromBuffer(buffer, byteOffset, length); | 18010 _TypedArrayFactoryProvider.createUint16Array_fromBuffer(buffer, byteOffset, length); |
17991 | 18011 |
17992 static const int BYTES_PER_ELEMENT = 2; | 18012 static const int BYTES_PER_ELEMENT = 2; |
17993 | 18013 |
17994 /** @domName Uint16Array.length */ | 18014 /** @domName Uint16Array.length */ |
17995 final int length; | 18015 final int length; |
17996 | 18016 |
17997 int operator[](int index) => JS("int", "#[#]", this, index); | 18017 int operator[](int index) => JS("int", "#[#]", this, index); |
17998 | 18018 |
17999 void operator[]=(int index, int value) { JS("void", "#[#] = #", this, index, v alue); } | 18019 void operator[]=(int index, int value) { JS("void", "#[#] = #", this, index, v alue); } // -- start List<int> mixins. |
18000 // -- start List<int> mixins. | |
18001 // int is the element type. | 18020 // int is the element type. |
18002 | 18021 |
18003 // From Iterable<int>: | 18022 // From Iterable<int>: |
18004 | 18023 |
18005 Iterator<int> iterator() { | 18024 Iterator<int> iterator() { |
18006 // Note: NodeLists are not fixed size. And most probably length shouldn't | 18025 // Note: NodeLists are not fixed size. And most probably length shouldn't |
18007 // be cached in both iterator _and_ forEach method. For now caching it | 18026 // be cached in both iterator _and_ forEach method. For now caching it |
18008 // for consistency. | 18027 // for consistency. |
18009 return new FixedSizeListIterator<int>(this); | 18028 return new FixedSizeListIterator<int>(this); |
18010 } | 18029 } |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
18100 factory Uint32Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length ]) => | 18119 factory Uint32Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length ]) => |
18101 _TypedArrayFactoryProvider.createUint32Array_fromBuffer(buffer, byteOffset, length); | 18120 _TypedArrayFactoryProvider.createUint32Array_fromBuffer(buffer, byteOffset, length); |
18102 | 18121 |
18103 static const int BYTES_PER_ELEMENT = 4; | 18122 static const int BYTES_PER_ELEMENT = 4; |
18104 | 18123 |
18105 /** @domName Uint32Array.length */ | 18124 /** @domName Uint32Array.length */ |
18106 final int length; | 18125 final int length; |
18107 | 18126 |
18108 int operator[](int index) => JS("int", "#[#]", this, index); | 18127 int operator[](int index) => JS("int", "#[#]", this, index); |
18109 | 18128 |
18110 void operator[]=(int index, int value) { JS("void", "#[#] = #", this, index, v alue); } | 18129 void operator[]=(int index, int value) { JS("void", "#[#] = #", this, index, v alue); } // -- start List<int> mixins. |
18111 // -- start List<int> mixins. | |
18112 // int is the element type. | 18130 // int is the element type. |
18113 | 18131 |
18114 // From Iterable<int>: | 18132 // From Iterable<int>: |
18115 | 18133 |
18116 Iterator<int> iterator() { | 18134 Iterator<int> iterator() { |
18117 // Note: NodeLists are not fixed size. And most probably length shouldn't | 18135 // Note: NodeLists are not fixed size. And most probably length shouldn't |
18118 // be cached in both iterator _and_ forEach method. For now caching it | 18136 // be cached in both iterator _and_ forEach method. For now caching it |
18119 // for consistency. | 18137 // for consistency. |
18120 return new FixedSizeListIterator<int>(this); | 18138 return new FixedSizeListIterator<int>(this); |
18121 } | 18139 } |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
18211 factory Uint8Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length] ) => | 18229 factory Uint8Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length] ) => |
18212 _TypedArrayFactoryProvider.createUint8Array_fromBuffer(buffer, byteOffset, l ength); | 18230 _TypedArrayFactoryProvider.createUint8Array_fromBuffer(buffer, byteOffset, l ength); |
18213 | 18231 |
18214 static const int BYTES_PER_ELEMENT = 1; | 18232 static const int BYTES_PER_ELEMENT = 1; |
18215 | 18233 |
18216 /** @domName Uint8Array.length */ | 18234 /** @domName Uint8Array.length */ |
18217 final int length; | 18235 final int length; |
18218 | 18236 |
18219 int operator[](int index) => JS("int", "#[#]", this, index); | 18237 int operator[](int index) => JS("int", "#[#]", this, index); |
18220 | 18238 |
18221 void operator[]=(int index, int value) { JS("void", "#[#] = #", this, index, v alue); } | 18239 void operator[]=(int index, int value) { JS("void", "#[#] = #", this, index, v alue); } // -- start List<int> mixins. |
18222 // -- start List<int> mixins. | |
18223 // int is the element type. | 18240 // int is the element type. |
18224 | 18241 |
18225 // From Iterable<int>: | 18242 // From Iterable<int>: |
18226 | 18243 |
18227 Iterator<int> iterator() { | 18244 Iterator<int> iterator() { |
18228 // Note: NodeLists are not fixed size. And most probably length shouldn't | 18245 // Note: NodeLists are not fixed size. And most probably length shouldn't |
18229 // be cached in both iterator _and_ forEach method. For now caching it | 18246 // be cached in both iterator _and_ forEach method. For now caching it |
18230 // for consistency. | 18247 // for consistency. |
18231 return new FixedSizeListIterator<int>(this); | 18248 return new FixedSizeListIterator<int>(this); |
18232 } | 18249 } |
(...skipping 6766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
24999 if (length < 0) throw new ArgumentError('length'); | 25016 if (length < 0) throw new ArgumentError('length'); |
25000 if (start < 0) throw new RangeError.value(start); | 25017 if (start < 0) throw new RangeError.value(start); |
25001 int end = start + length; | 25018 int end = start + length; |
25002 if (end > a.length) throw new RangeError.value(end); | 25019 if (end > a.length) throw new RangeError.value(end); |
25003 for (int i = start; i < end; i++) { | 25020 for (int i = start; i < end; i++) { |
25004 accumulator.add(a[i]); | 25021 accumulator.add(a[i]); |
25005 } | 25022 } |
25006 return accumulator; | 25023 return accumulator; |
25007 } | 25024 } |
25008 } | 25025 } |
OLD | NEW |