| OLD | NEW |
| 1 library html; | 1 library html; |
| 2 | 2 |
| 3 import 'dart:async'; | 3 import 'dart:async'; |
| 4 import 'dart:collection'; | 4 import 'dart:collection'; |
| 5 import 'dart:html_common'; | 5 import 'dart:html_common'; |
| 6 import 'dart:indexed_db'; | 6 import 'dart:indexed_db'; |
| 7 import 'dart:isolate'; | 7 import 'dart:isolate'; |
| 8 import 'dart:json' as json; | 8 import 'dart:json' as json; |
| 9 import 'dart:math'; | 9 import 'dart:math'; |
| 10 import 'dart:svg' as svg; | 10 import 'dart:svg' as svg; |
| (...skipping 7181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7192 | 7192 |
| 7193 String join([String separator]) { | 7193 String join([String separator]) { |
| 7194 return Collections.joinList(this, separator); | 7194 return Collections.joinList(this, separator); |
| 7195 } | 7195 } |
| 7196 | 7196 |
| 7197 List mappedBy(f(Element element)) { | 7197 List mappedBy(f(Element element)) { |
| 7198 return new MappedList<Element, dynamic>(this, f); | 7198 return new MappedList<Element, dynamic>(this, f); |
| 7199 } | 7199 } |
| 7200 | 7200 |
| 7201 Iterable<Element> where(bool f(Element element)) | 7201 Iterable<Element> where(bool f(Element element)) |
| 7202 => new WhereIterable<Element>(this, f); | 7202 => new WhereIterable(this, f); |
| 7203 | 7203 |
| 7204 bool get isEmpty { | 7204 bool get isEmpty { |
| 7205 return _element.$dom_firstElementChild == null; | 7205 return _element.$dom_firstElementChild == null; |
| 7206 } | 7206 } |
| 7207 | 7207 |
| 7208 List<Element> take(int n) { | 7208 List<Element> take(int n) { |
| 7209 return new ListView<Element>(this, 0, n); | 7209 return new ListView<Element>(this, 0, n); |
| 7210 } | 7210 } |
| 7211 | 7211 |
| 7212 Iterable<Element> takeWhile(bool test(Element value)) { | 7212 Iterable<Element> takeWhile(bool test(Element value)) { |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7375 | 7375 |
| 7376 String join([String separator]) { | 7376 String join([String separator]) { |
| 7377 return Collections.joinList(this, separator); | 7377 return Collections.joinList(this, separator); |
| 7378 } | 7378 } |
| 7379 | 7379 |
| 7380 List mappedBy(f(Element element)) { | 7380 List mappedBy(f(Element element)) { |
| 7381 return new MappedList<Element, dynamic>(this, f); | 7381 return new MappedList<Element, dynamic>(this, f); |
| 7382 } | 7382 } |
| 7383 | 7383 |
| 7384 Iterable<Element> where(bool f(Element element)) | 7384 Iterable<Element> where(bool f(Element element)) |
| 7385 => new WhereIterable<Element>(this, f); | 7385 => new WhereIterable(this, f); |
| 7386 | 7386 |
| 7387 bool every(bool f(Element element)) { | 7387 bool every(bool f(Element element)) { |
| 7388 for(Element element in this) { | 7388 for(Element element in this) { |
| 7389 if (!f(element)) { | 7389 if (!f(element)) { |
| 7390 return false; | 7390 return false; |
| 7391 } | 7391 } |
| 7392 }; | 7392 }; |
| 7393 return true; | 7393 return true; |
| 7394 } | 7394 } |
| 7395 | 7395 |
| (...skipping 9146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16542 Node namedItem(String name) native; | 16542 Node namedItem(String name) native; |
| 16543 | 16543 |
| 16544 /// @domName HTMLSelectElement.setCustomValidity; @docsEditable true | 16544 /// @domName HTMLSelectElement.setCustomValidity; @docsEditable true |
| 16545 void setCustomValidity(String error) native; | 16545 void setCustomValidity(String error) native; |
| 16546 | 16546 |
| 16547 | 16547 |
| 16548 // Override default options, since IE returns SelectElement itself and it | 16548 // Override default options, since IE returns SelectElement itself and it |
| 16549 // does not operate as a List. | 16549 // does not operate as a List. |
| 16550 List<OptionElement> get options { | 16550 List<OptionElement> get options { |
| 16551 var options = this.children.where((e) => e is OptionElement).toList(); | 16551 var options = this.children.where((e) => e is OptionElement).toList(); |
| 16552 return new ListView<OptionElement>(options, 0, options.length); | 16552 return new ListView(options, 0, options.length); |
| 16553 } | 16553 } |
| 16554 | 16554 |
| 16555 List<OptionElement> get selectedOptions { | 16555 List<OptionElement> get selectedOptions { |
| 16556 // IE does not change the selected flag for single-selection items. | 16556 // IE does not change the selected flag for single-selection items. |
| 16557 if (this.multiple) { | 16557 if (this.multiple) { |
| 16558 var options = this.options.where((o) => o.selected).toList(); | 16558 var options = this.options.where((o) => o.selected).toList(); |
| 16559 return new ListView<OptionElement>(options, 0, options.length); | 16559 return new ListView(options, 0, options.length); |
| 16560 } else { | 16560 } else { |
| 16561 return [this.options[this.selectedIndex]]; | 16561 return [this.options[this.selectedIndex]]; |
| 16562 } | 16562 } |
| 16563 } | 16563 } |
| 16564 } | 16564 } |
| 16565 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 16565 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 16566 // for details. All rights reserved. Use of this source code is governed by a | 16566 // for details. All rights reserved. Use of this source code is governed by a |
| 16567 // BSD-style license that can be found in the LICENSE file. | 16567 // BSD-style license that can be found in the LICENSE file. |
| 16568 | 16568 |
| 16569 | 16569 |
| (...skipping 8223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 24793 } | 24793 } |
| 24794 _dispatch(e); | 24794 _dispatch(e); |
| 24795 } | 24795 } |
| 24796 } | 24796 } |
| 24797 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 24797 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 24798 // for details. All rights reserved. Use of this source code is governed by a | 24798 // for details. All rights reserved. Use of this source code is governed by a |
| 24799 // BSD-style license that can be found in the LICENSE file. | 24799 // BSD-style license that can be found in the LICENSE file. |
| 24800 | 24800 |
| 24801 | 24801 |
| 24802 /** | 24802 /** |
| 24803 * Defines the keycode values for keys that are returned by | 24803 * Defines the keycode values for keys that are returned by |
| 24804 * KeyboardEvent.keyCode. | 24804 * KeyboardEvent.keyCode. |
| 24805 * | 24805 * |
| 24806 * Important note: There is substantial divergence in how different browsers | 24806 * Important note: There is substantial divergence in how different browsers |
| 24807 * handle keycodes and their variants in different locales/keyboard layouts. We | 24807 * handle keycodes and their variants in different locales/keyboard layouts. We |
| 24808 * provide these constants to help make code processing keys more readable. | 24808 * provide these constants to help make code processing keys more readable. |
| 24809 */ | 24809 */ |
| 24810 abstract class KeyCode { | 24810 abstract class KeyCode { |
| 24811 // These constant names were borrowed from Closure's Keycode enumeration | 24811 // These constant names were borrowed from Closure's Keycode enumeration |
| 24812 // class. | 24812 // class. |
| 24813 // http://closure-library.googlecode.com/svn/docs/closure_goog_events_keycodes
.js.source.html | 24813 // http://closure-library.googlecode.com/svn/docs/closure_goog_events_keycodes
.js.source.html |
| 24814 static const int WIN_KEY_FF_LINUX = 0; | 24814 static const int WIN_KEY_FF_LINUX = 0; |
| 24815 static const int MAC_ENTER = 3; | 24815 static const int MAC_ENTER = 3; |
| 24816 static const int BACKSPACE = 8; | 24816 static const int BACKSPACE = 8; |
| 24817 static const int TAB = 9; | 24817 static const int TAB = 9; |
| 24818 /** NUM_CENTER is also NUMLOCK for FF and Safari on Mac. */ | 24818 /** NUM_CENTER is also NUMLOCK for FF and Safari on Mac. */ |
| 24819 static const int NUM_CENTER = 12; | 24819 static const int NUM_CENTER = 12; |
| 24820 static const int ENTER = 13; | 24820 static const int ENTER = 13; |
| 24821 static const int SHIFT = 16; | 24821 static const int SHIFT = 16; |
| 24822 static const int CTRL = 17; | 24822 static const int CTRL = 17; |
| 24823 static const int ALT = 18; | 24823 static const int ALT = 18; |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 24998 * Returns true if the keyCode produces a (US keyboard) character. | 24998 * Returns true if the keyCode produces a (US keyboard) character. |
| 24999 * Note: This does not (yet) cover characters on non-US keyboards (Russian, | 24999 * Note: This does not (yet) cover characters on non-US keyboards (Russian, |
| 25000 * Hebrew, etc.). | 25000 * Hebrew, etc.). |
| 25001 */ | 25001 */ |
| 25002 static bool isCharacterKey(int keyCode) { | 25002 static bool isCharacterKey(int keyCode) { |
| 25003 if ((keyCode >= ZERO && keyCode <= NINE) || | 25003 if ((keyCode >= ZERO && keyCode <= NINE) || |
| 25004 (keyCode >= NUM_ZERO && keyCode <= NUM_MULTIPLY) || | 25004 (keyCode >= NUM_ZERO && keyCode <= NUM_MULTIPLY) || |
| 25005 (keyCode >= A && keyCode <= Z)) { | 25005 (keyCode >= A && keyCode <= Z)) { |
| 25006 return true; | 25006 return true; |
| 25007 } | 25007 } |
| 25008 | 25008 |
| 25009 // Safari sends zero key code for non-latin characters. | 25009 // Safari sends zero key code for non-latin characters. |
| 25010 if (_Device.isWebKit && keyCode == 0) { | 25010 if (_Device.isWebKit && keyCode == 0) { |
| 25011 return true; | 25011 return true; |
| 25012 } | 25012 } |
| 25013 | 25013 |
| 25014 return (keyCode == SPACE || keyCode == QUESTION_MARK || keyCode == NUM_PLUS | 25014 return (keyCode == SPACE || keyCode == QUESTION_MARK || keyCode == NUM_PLUS |
| 25015 || keyCode == NUM_MINUS || keyCode == NUM_PERIOD || | 25015 || keyCode == NUM_MINUS || keyCode == NUM_PERIOD || |
| 25016 keyCode == NUM_DIVISION || keyCode == SEMICOLON || | 25016 keyCode == NUM_DIVISION || keyCode == SEMICOLON || |
| 25017 keyCode == FF_SEMICOLON || keyCode == DASH || keyCode == EQUALS || | 25017 keyCode == FF_SEMICOLON || keyCode == DASH || keyCode == EQUALS || |
| 25018 keyCode == FF_EQUALS || keyCode == COMMA || keyCode == PERIOD || | 25018 keyCode == FF_EQUALS || keyCode == COMMA || keyCode == PERIOD || |
| 25019 keyCode == SLASH || keyCode == APOSTROPHE || keyCode == SINGLE_QUOTE || | 25019 keyCode == SLASH || keyCode == APOSTROPHE || keyCode == SINGLE_QUOTE || |
| 25020 keyCode == OPEN_SQUARE_BRACKET || keyCode == BACKSLASH || | 25020 keyCode == OPEN_SQUARE_BRACKET || keyCode == BACKSLASH || |
| 25021 keyCode == CLOSE_SQUARE_BRACKET); | 25021 keyCode == CLOSE_SQUARE_BRACKET); |
| 25022 } | 25022 } |
| 25023 } | 25023 } |
| (...skipping 1848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 26872 // for details. All rights reserved. Use of this source code is governed by a | 26872 // for details. All rights reserved. Use of this source code is governed by a |
| 26873 // BSD-style license that can be found in the LICENSE file. | 26873 // BSD-style license that can be found in the LICENSE file. |
| 26874 | 26874 |
| 26875 | 26875 |
| 26876 // Iterator for arrays with fixed size. | 26876 // Iterator for arrays with fixed size. |
| 26877 class FixedSizeListIterator<T> implements Iterator<T> { | 26877 class FixedSizeListIterator<T> implements Iterator<T> { |
| 26878 final List<T> _array; | 26878 final List<T> _array; |
| 26879 final int _length; // Cache array length for faster access. | 26879 final int _length; // Cache array length for faster access. |
| 26880 int _position; | 26880 int _position; |
| 26881 T _current; | 26881 T _current; |
| 26882 | 26882 |
| 26883 FixedSizeListIterator(List<T> array) | 26883 FixedSizeListIterator(List<T> array) |
| 26884 : _array = array, | 26884 : _array = array, |
| 26885 _position = -1, | 26885 _position = -1, |
| 26886 _length = array.length; | 26886 _length = array.length; |
| 26887 | 26887 |
| 26888 bool moveNext() { | 26888 bool moveNext() { |
| 26889 int nextPosition = _position + 1; | 26889 int nextPosition = _position + 1; |
| 26890 if (nextPosition < _length) { | 26890 if (nextPosition < _length) { |
| 26891 _current = _array[nextPosition]; | 26891 _current = _array[nextPosition]; |
| 26892 _position = nextPosition; | 26892 _position = nextPosition; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 26917 _position = nextPosition; | 26917 _position = nextPosition; |
| 26918 return true; | 26918 return true; |
| 26919 } | 26919 } |
| 26920 _current = null; | 26920 _current = null; |
| 26921 _position = _array.length; | 26921 _position = _array.length; |
| 26922 return false; | 26922 return false; |
| 26923 } | 26923 } |
| 26924 | 26924 |
| 26925 T get current => _current; | 26925 T get current => _current; |
| 26926 } | 26926 } |
| OLD | NEW |