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 6767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6778 | 6778 |
6779 class DocumentFragment extends Node native "*DocumentFragment" { | 6779 class DocumentFragment extends Node native "*DocumentFragment" { |
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> get elements => this.children; |
6789 | |
6790 List<Element> get elements { | |
6791 if (_elements == null) { | |
6792 _elements = new FilteredElementList(this); | |
6793 } | |
6794 return _elements; | |
6795 } | |
6796 | 6789 |
6797 // TODO: The type of value should be Collection<Element>. See http://b/5392897 | 6790 // TODO: The type of value should be Collection<Element>. See http://b/5392897 |
6798 void set elements(value) { | 6791 void set elements(value) { |
6792 this.children = value; | |
6793 } | |
6794 | |
6795 List<Element> _children; | |
6796 | |
6797 @Creates('Null') | |
sra1
2012/11/19 22:16:34
This goes on the field '_children'.
Please include
blois
2012/11/19 22:58:53
Done.
| |
6798 List<Element> get children { | |
6799 if (_children == null) { | |
6800 _children = new FilteredElementList(this); | |
6801 } | |
6802 return _children; | |
6803 } | |
6804 | |
6805 void set children(Collection<Element> value) { | |
6799 // Copy list first since we don't want liveness during iteration. | 6806 // Copy list first since we don't want liveness during iteration. |
6800 List copy = new List.from(value); | 6807 List copy = new List.from(value); |
6801 final elements = this.elements; | 6808 var children = this.children; |
6802 elements.clear(); | 6809 children.clear(); |
6803 elements.addAll(copy); | 6810 children.addAll(copy); |
6804 } | 6811 } |
6805 | 6812 |
6806 Element query(String selectors) => $dom_querySelector(selectors); | 6813 Element query(String selectors) => $dom_querySelector(selectors); |
6807 | 6814 |
6808 List<Element> queryAll(String selectors) => | 6815 List<Element> queryAll(String selectors) => |
6809 new _FrozenElementList._wrap($dom_querySelectorAll(selectors)); | 6816 new _FrozenElementList._wrap($dom_querySelectorAll(selectors)); |
6810 | 6817 |
6811 String get innerHTML { | 6818 String get innerHTML { |
6812 final e = new Element.tag("div"); | 6819 final e = new Element.tag("div"); |
6813 e.nodes.add(this.clone(true)); | 6820 e.nodes.add(this.clone(true)); |
(...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7614 | 7621 |
7615 void set attributes(Map<String, String> value) { | 7622 void set attributes(Map<String, String> value) { |
7616 Map<String, String> attributes = this.attributes; | 7623 Map<String, String> attributes = this.attributes; |
7617 attributes.clear(); | 7624 attributes.clear(); |
7618 for (String key in value.keys) { | 7625 for (String key in value.keys) { |
7619 attributes[key] = value[key]; | 7626 attributes[key] = value[key]; |
7620 } | 7627 } |
7621 } | 7628 } |
7622 | 7629 |
7623 void set elements(Collection<Element> value) { | 7630 void set elements(Collection<Element> value) { |
7624 final elements = this.elements; | 7631 this.children = value; |
7625 elements.clear(); | |
7626 elements.addAll(value); | |
7627 } | 7632 } |
7628 | 7633 |
7629 /** | 7634 /** |
7635 * Deprecated, use [children] instead. | |
7636 */ | |
7637 List<Element> get elements => this.children; | |
7638 | |
7639 /** | |
7630 * @domName childElementCount, firstElementChild, lastElementChild, | 7640 * @domName childElementCount, firstElementChild, lastElementChild, |
7631 * children, Node.nodes.add | 7641 * children, Node.nodes.add |
7632 */ | 7642 */ |
7633 List<Element> get elements => new _ChildrenElementList._wrap(this); | 7643 @Creates('Null') |
sra1
2012/11/19 22:16:34
Remove.
Not needed on Dart code, only fields and m
blois
2012/11/19 22:58:53
Done.
| |
7644 List<Element> get children => new _ChildrenElementList._wrap(this); | |
7645 | |
7646 void set children(Collection<Element> value) { | |
7647 // Copy list first since we don't want liveness during iteration. | |
7648 List copy = new List.from(value); | |
7649 var children = this.children; | |
7650 children.clear(); | |
7651 children.addAll(copy); | |
7652 } | |
7634 | 7653 |
7635 Element query(String selectors) => $dom_querySelector(selectors); | 7654 Element query(String selectors) => $dom_querySelector(selectors); |
7636 | 7655 |
7637 List<Element> queryAll(String selectors) => | 7656 List<Element> queryAll(String selectors) => |
7638 new _FrozenElementList._wrap($dom_querySelectorAll(selectors)); | 7657 new _FrozenElementList._wrap($dom_querySelectorAll(selectors)); |
7639 | 7658 |
7640 /** @domName className, classList */ | 7659 /** @domName className, classList */ |
7641 CssClassSet get classes => new _ElementCssClassSet(this); | 7660 CssClassSet get classes => new _ElementCssClassSet(this); |
7642 | 7661 |
7643 void set classes(Collection<String> value) { | 7662 void set classes(Collection<String> value) { |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7977 if (match != null) { | 7996 if (match != null) { |
7978 tag = match.group(1).toLowerCase(); | 7997 tag = match.group(1).toLowerCase(); |
7979 if (_CUSTOM_PARENT_TAG_MAP.containsKey(tag)) { | 7998 if (_CUSTOM_PARENT_TAG_MAP.containsKey(tag)) { |
7980 parentTag = _CUSTOM_PARENT_TAG_MAP[tag]; | 7999 parentTag = _CUSTOM_PARENT_TAG_MAP[tag]; |
7981 } | 8000 } |
7982 } | 8001 } |
7983 final Element temp = new Element.tag(parentTag); | 8002 final Element temp = new Element.tag(parentTag); |
7984 temp.innerHTML = html; | 8003 temp.innerHTML = html; |
7985 | 8004 |
7986 Element element; | 8005 Element element; |
7987 if (temp.elements.length == 1) { | 8006 if (temp.children.length == 1) { |
7988 element = temp.elements[0]; | 8007 element = temp.children[0]; |
7989 } else if (parentTag == 'html' && temp.elements.length == 2) { | 8008 } else if (parentTag == 'html' && temp.children.length == 2) { |
7990 // Work around for edge case in WebKit and possibly other browsers where | 8009 // 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 | 8010 // both body and head elements are created even though the inner html |
7992 // only contains a head or body element. | 8011 // only contains a head or body element. |
7993 element = temp.elements[tag == 'head' ? 0 : 1]; | 8012 element = temp.children[tag == 'head' ? 0 : 1]; |
7994 } else { | 8013 } else { |
7995 throw new ArgumentError('HTML had ${temp.elements.length} ' | 8014 throw new ArgumentError('HTML had ${temp.children.length} ' |
7996 'top level elements but 1 expected'); | 8015 'top level elements but 1 expected'); |
7997 } | 8016 } |
7998 element.remove(); | 8017 element.remove(); |
7999 return element; | 8018 return element; |
8000 } | 8019 } |
8001 | 8020 |
8002 /** @domName Document.createElement */ | 8021 /** @domName Document.createElement */ |
8003 // Optimization to improve performance until the dart2js compiler inlines this | 8022 // Optimization to improve performance until the dart2js compiler inlines this |
8004 // method. | 8023 // method. |
8005 static Element createElement_tag(String tag) => | 8024 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]) => | 8974 factory Float32Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int lengt h]) => |
8956 _TypedArrayFactoryProvider.createFloat32Array_fromBuffer(buffer, byteOffset, length); | 8975 _TypedArrayFactoryProvider.createFloat32Array_fromBuffer(buffer, byteOffset, length); |
8957 | 8976 |
8958 static const int BYTES_PER_ELEMENT = 4; | 8977 static const int BYTES_PER_ELEMENT = 4; |
8959 | 8978 |
8960 /** @domName Float32Array.length */ | 8979 /** @domName Float32Array.length */ |
8961 final int length; | 8980 final int length; |
8962 | 8981 |
8963 num operator[](int index) => JS("num", "#[#]", this, index); | 8982 num operator[](int index) => JS("num", "#[#]", this, index); |
8964 | 8983 |
8965 void operator[]=(int index, num value) { JS("void", "#[#] = #", this, index, v alue); } | 8984 void operator[]=(int index, num value) { JS("void", "#[#] = #", this, index, v alue); } // -- start List<num> mixins. |
sra1
2012/11/19 22:16:34
What happened here?
blois
2012/11/19 22:58:53
Looks like the file was out of date. Sync'd and it
| |
8966 // -- start List<num> mixins. | |
8967 // num is the element type. | 8985 // num is the element type. |
8968 | 8986 |
8969 // From Iterable<num>: | 8987 // From Iterable<num>: |
8970 | 8988 |
8971 Iterator<num> iterator() { | 8989 Iterator<num> iterator() { |
8972 // Note: NodeLists are not fixed size. And most probably length shouldn't | 8990 // 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 | 8991 // be cached in both iterator _and_ forEach method. For now caching it |
8974 // for consistency. | 8992 // for consistency. |
8975 return new FixedSizeListIterator<num>(this); | 8993 return new FixedSizeListIterator<num>(this); |
8976 } | 8994 } |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
9066 factory Float64Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int lengt h]) => | 9084 factory Float64Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int lengt h]) => |
9067 _TypedArrayFactoryProvider.createFloat64Array_fromBuffer(buffer, byteOffset, length); | 9085 _TypedArrayFactoryProvider.createFloat64Array_fromBuffer(buffer, byteOffset, length); |
9068 | 9086 |
9069 static const int BYTES_PER_ELEMENT = 8; | 9087 static const int BYTES_PER_ELEMENT = 8; |
9070 | 9088 |
9071 /** @domName Float64Array.length */ | 9089 /** @domName Float64Array.length */ |
9072 final int length; | 9090 final int length; |
9073 | 9091 |
9074 num operator[](int index) => JS("num", "#[#]", this, index); | 9092 num operator[](int index) => JS("num", "#[#]", this, index); |
9075 | 9093 |
9076 void operator[]=(int index, num value) { JS("void", "#[#] = #", this, index, v alue); } | 9094 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. | 9095 // num is the element type. |
9079 | 9096 |
9080 // From Iterable<num>: | 9097 // From Iterable<num>: |
9081 | 9098 |
9082 Iterator<num> iterator() { | 9099 Iterator<num> iterator() { |
9083 // Note: NodeLists are not fixed size. And most probably length shouldn't | 9100 // 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 | 9101 // be cached in both iterator _and_ forEach method. For now caching it |
9085 // for consistency. | 9102 // for consistency. |
9086 return new FixedSizeListIterator<num>(this); | 9103 return new FixedSizeListIterator<num>(this); |
9087 } | 9104 } |
(...skipping 2099 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
11187 factory Int16Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length] ) => | 11204 factory Int16Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length] ) => |
11188 _TypedArrayFactoryProvider.createInt16Array_fromBuffer(buffer, byteOffset, l ength); | 11205 _TypedArrayFactoryProvider.createInt16Array_fromBuffer(buffer, byteOffset, l ength); |
11189 | 11206 |
11190 static const int BYTES_PER_ELEMENT = 2; | 11207 static const int BYTES_PER_ELEMENT = 2; |
11191 | 11208 |
11192 /** @domName Int16Array.length */ | 11209 /** @domName Int16Array.length */ |
11193 final int length; | 11210 final int length; |
11194 | 11211 |
11195 int operator[](int index) => JS("int", "#[#]", this, index); | 11212 int operator[](int index) => JS("int", "#[#]", this, index); |
11196 | 11213 |
11197 void operator[]=(int index, int value) { JS("void", "#[#] = #", this, index, v alue); } | 11214 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. | 11215 // int is the element type. |
11200 | 11216 |
11201 // From Iterable<int>: | 11217 // From Iterable<int>: |
11202 | 11218 |
11203 Iterator<int> iterator() { | 11219 Iterator<int> iterator() { |
11204 // Note: NodeLists are not fixed size. And most probably length shouldn't | 11220 // 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 | 11221 // be cached in both iterator _and_ forEach method. For now caching it |
11206 // for consistency. | 11222 // for consistency. |
11207 return new FixedSizeListIterator<int>(this); | 11223 return new FixedSizeListIterator<int>(this); |
11208 } | 11224 } |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
11298 factory Int32Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length] ) => | 11314 factory Int32Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length] ) => |
11299 _TypedArrayFactoryProvider.createInt32Array_fromBuffer(buffer, byteOffset, l ength); | 11315 _TypedArrayFactoryProvider.createInt32Array_fromBuffer(buffer, byteOffset, l ength); |
11300 | 11316 |
11301 static const int BYTES_PER_ELEMENT = 4; | 11317 static const int BYTES_PER_ELEMENT = 4; |
11302 | 11318 |
11303 /** @domName Int32Array.length */ | 11319 /** @domName Int32Array.length */ |
11304 final int length; | 11320 final int length; |
11305 | 11321 |
11306 int operator[](int index) => JS("int", "#[#]", this, index); | 11322 int operator[](int index) => JS("int", "#[#]", this, index); |
11307 | 11323 |
11308 void operator[]=(int index, int value) { JS("void", "#[#] = #", this, index, v alue); } | 11324 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. | 11325 // int is the element type. |
11311 | 11326 |
11312 // From Iterable<int>: | 11327 // From Iterable<int>: |
11313 | 11328 |
11314 Iterator<int> iterator() { | 11329 Iterator<int> iterator() { |
11315 // Note: NodeLists are not fixed size. And most probably length shouldn't | 11330 // 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 | 11331 // be cached in both iterator _and_ forEach method. For now caching it |
11317 // for consistency. | 11332 // for consistency. |
11318 return new FixedSizeListIterator<int>(this); | 11333 return new FixedSizeListIterator<int>(this); |
11319 } | 11334 } |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
11409 factory Int8Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length]) => | 11424 factory Int8Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length]) => |
11410 _TypedArrayFactoryProvider.createInt8Array_fromBuffer(buffer, byteOffset, le ngth); | 11425 _TypedArrayFactoryProvider.createInt8Array_fromBuffer(buffer, byteOffset, le ngth); |
11411 | 11426 |
11412 static const int BYTES_PER_ELEMENT = 1; | 11427 static const int BYTES_PER_ELEMENT = 1; |
11413 | 11428 |
11414 /** @domName Int8Array.length */ | 11429 /** @domName Int8Array.length */ |
11415 final int length; | 11430 final int length; |
11416 | 11431 |
11417 int operator[](int index) => JS("int", "#[#]", this, index); | 11432 int operator[](int index) => JS("int", "#[#]", this, index); |
11418 | 11433 |
11419 void operator[]=(int index, int value) { JS("void", "#[#] = #", this, index, v alue); } | 11434 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. | 11435 // int is the element type. |
11422 | 11436 |
11423 // From Iterable<int>: | 11437 // From Iterable<int>: |
11424 | 11438 |
11425 Iterator<int> iterator() { | 11439 Iterator<int> iterator() { |
11426 // Note: NodeLists are not fixed size. And most probably length shouldn't | 11440 // 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 | 11441 // be cached in both iterator _and_ forEach method. For now caching it |
11428 // for consistency. | 11442 // for consistency. |
11429 return new FixedSizeListIterator<int>(this); | 11443 return new FixedSizeListIterator<int>(this); |
11430 } | 11444 } |
(...skipping 6558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
17989 factory Uint16Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length ]) => | 18003 factory Uint16Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length ]) => |
17990 _TypedArrayFactoryProvider.createUint16Array_fromBuffer(buffer, byteOffset, length); | 18004 _TypedArrayFactoryProvider.createUint16Array_fromBuffer(buffer, byteOffset, length); |
17991 | 18005 |
17992 static const int BYTES_PER_ELEMENT = 2; | 18006 static const int BYTES_PER_ELEMENT = 2; |
17993 | 18007 |
17994 /** @domName Uint16Array.length */ | 18008 /** @domName Uint16Array.length */ |
17995 final int length; | 18009 final int length; |
17996 | 18010 |
17997 int operator[](int index) => JS("int", "#[#]", this, index); | 18011 int operator[](int index) => JS("int", "#[#]", this, index); |
17998 | 18012 |
17999 void operator[]=(int index, int value) { JS("void", "#[#] = #", this, index, v alue); } | 18013 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. | 18014 // int is the element type. |
18002 | 18015 |
18003 // From Iterable<int>: | 18016 // From Iterable<int>: |
18004 | 18017 |
18005 Iterator<int> iterator() { | 18018 Iterator<int> iterator() { |
18006 // Note: NodeLists are not fixed size. And most probably length shouldn't | 18019 // 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 | 18020 // be cached in both iterator _and_ forEach method. For now caching it |
18008 // for consistency. | 18021 // for consistency. |
18009 return new FixedSizeListIterator<int>(this); | 18022 return new FixedSizeListIterator<int>(this); |
18010 } | 18023 } |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
18100 factory Uint32Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length ]) => | 18113 factory Uint32Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length ]) => |
18101 _TypedArrayFactoryProvider.createUint32Array_fromBuffer(buffer, byteOffset, length); | 18114 _TypedArrayFactoryProvider.createUint32Array_fromBuffer(buffer, byteOffset, length); |
18102 | 18115 |
18103 static const int BYTES_PER_ELEMENT = 4; | 18116 static const int BYTES_PER_ELEMENT = 4; |
18104 | 18117 |
18105 /** @domName Uint32Array.length */ | 18118 /** @domName Uint32Array.length */ |
18106 final int length; | 18119 final int length; |
18107 | 18120 |
18108 int operator[](int index) => JS("int", "#[#]", this, index); | 18121 int operator[](int index) => JS("int", "#[#]", this, index); |
18109 | 18122 |
18110 void operator[]=(int index, int value) { JS("void", "#[#] = #", this, index, v alue); } | 18123 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. | 18124 // int is the element type. |
18113 | 18125 |
18114 // From Iterable<int>: | 18126 // From Iterable<int>: |
18115 | 18127 |
18116 Iterator<int> iterator() { | 18128 Iterator<int> iterator() { |
18117 // Note: NodeLists are not fixed size. And most probably length shouldn't | 18129 // 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 | 18130 // be cached in both iterator _and_ forEach method. For now caching it |
18119 // for consistency. | 18131 // for consistency. |
18120 return new FixedSizeListIterator<int>(this); | 18132 return new FixedSizeListIterator<int>(this); |
18121 } | 18133 } |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
18211 factory Uint8Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length] ) => | 18223 factory Uint8Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length] ) => |
18212 _TypedArrayFactoryProvider.createUint8Array_fromBuffer(buffer, byteOffset, l ength); | 18224 _TypedArrayFactoryProvider.createUint8Array_fromBuffer(buffer, byteOffset, l ength); |
18213 | 18225 |
18214 static const int BYTES_PER_ELEMENT = 1; | 18226 static const int BYTES_PER_ELEMENT = 1; |
18215 | 18227 |
18216 /** @domName Uint8Array.length */ | 18228 /** @domName Uint8Array.length */ |
18217 final int length; | 18229 final int length; |
18218 | 18230 |
18219 int operator[](int index) => JS("int", "#[#]", this, index); | 18231 int operator[](int index) => JS("int", "#[#]", this, index); |
18220 | 18232 |
18221 void operator[]=(int index, int value) { JS("void", "#[#] = #", this, index, v alue); } | 18233 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. | 18234 // int is the element type. |
18224 | 18235 |
18225 // From Iterable<int>: | 18236 // From Iterable<int>: |
18226 | 18237 |
18227 Iterator<int> iterator() { | 18238 Iterator<int> iterator() { |
18228 // Note: NodeLists are not fixed size. And most probably length shouldn't | 18239 // 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 | 18240 // be cached in both iterator _and_ forEach method. For now caching it |
18230 // for consistency. | 18241 // for consistency. |
18231 return new FixedSizeListIterator<int>(this); | 18242 return new FixedSizeListIterator<int>(this); |
18232 } | 18243 } |
(...skipping 6766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
24999 if (length < 0) throw new ArgumentError('length'); | 25010 if (length < 0) throw new ArgumentError('length'); |
25000 if (start < 0) throw new RangeError.value(start); | 25011 if (start < 0) throw new RangeError.value(start); |
25001 int end = start + length; | 25012 int end = start + length; |
25002 if (end > a.length) throw new RangeError.value(end); | 25013 if (end > a.length) throw new RangeError.value(end); |
25003 for (int i = start; i < end; i++) { | 25014 for (int i = start; i < end; i++) { |
25004 accumulator.add(a[i]); | 25015 accumulator.add(a[i]); |
25005 } | 25016 } |
25006 return accumulator; | 25017 return accumulator; |
25007 } | 25018 } |
25008 } | 25019 } |
OLD | NEW |