| OLD | NEW |
| 1 library html; | 1 library html; |
| 2 | 2 |
| 3 import 'dart:collection'; | 3 import 'dart:collection'; |
| 4 import 'dart:html_common'; | 4 import 'dart:html_common'; |
| 5 import 'dart:indexed_db'; | 5 import 'dart:indexed_db'; |
| 6 import 'dart:isolate'; | 6 import 'dart:isolate'; |
| 7 import 'dart:json'; | 7 import 'dart:json'; |
| 8 import 'dart:svg' as svg; | 8 import 'dart:svg' as svg; |
| 9 import 'dart:web_audio' as web_audio; | 9 import 'dart:web_audio' as web_audio; |
| 10 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 10 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| (...skipping 10190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10201 final int x; | 10201 final int x; |
| 10202 | 10202 |
| 10203 /// @domName HTMLImageElement.y; @docsEditable true | 10203 /// @domName HTMLImageElement.y; @docsEditable true |
| 10204 final int y; | 10204 final int y; |
| 10205 } | 10205 } |
| 10206 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 10206 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 10207 // for details. All rights reserved. Use of this source code is governed by a | 10207 // for details. All rights reserved. Use of this source code is governed by a |
| 10208 // BSD-style license that can be found in the LICENSE file. | 10208 // BSD-style license that can be found in the LICENSE file. |
| 10209 | 10209 |
| 10210 | 10210 |
| 10211 /// @domName HTMLInputElement; @docsEditable true | 10211 /// @domName HTMLInputElement |
| 10212 class InputElement extends Element implements Element native "*HTMLInputElement"
{ | 10212 class InputElement extends Element implements |
| 10213 HiddenInputElement, |
| 10214 SearchInputElement, |
| 10215 TextInputElement, |
| 10216 UrlInputElement, |
| 10217 TelephoneInputElement, |
| 10218 EmailInputElement, |
| 10219 PasswordInputElement, |
| 10220 DateTimeInputElement, |
| 10221 DateInputElement, |
| 10222 MonthInputElement, |
| 10223 WeekInputElement, |
| 10224 TimeInputElement, |
| 10225 LocalDateTimeInputElement, |
| 10226 NumberInputElement, |
| 10227 RangeInputElement, |
| 10228 CheckboxInputElement, |
| 10229 RadioButtonInputElement, |
| 10230 FileUploadInputElement, |
| 10231 SubmitButtonInputElement, |
| 10232 ImageButtonInputElement, |
| 10233 ResetButtonInputElement, |
| 10234 ButtonInputElement |
| 10235 native "*HTMLInputElement" { |
| 10213 | 10236 |
| 10214 ///@docsEditable true | 10237 ///@docsEditable true |
| 10215 factory InputElement({String type}) { | 10238 factory InputElement({String type}) { |
| 10216 var e = document.$dom_createElement("input"); | 10239 var e = document.$dom_createElement("input"); |
| 10217 if (type != null) e.type = type; | 10240 if (type != null) e.type = type; |
| 10218 return e; | 10241 return e; |
| 10219 } | 10242 } |
| 10220 | 10243 |
| 10221 /// @domName EventTarget.addEventListener, EventTarget.removeEventListener, Ev
entTarget.dispatchEvent; @docsEditable true | 10244 /// @domName EventTarget.addEventListener, EventTarget.removeEventListener, Ev
entTarget.dispatchEvent; @docsEditable true |
| 10222 InputElementEvents get on => | 10245 InputElementEvents get on => |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10388 void setRangeText(String replacement, [int start, int end, String selectionMod
e]) native; | 10411 void setRangeText(String replacement, [int start, int end, String selectionMod
e]) native; |
| 10389 | 10412 |
| 10390 /// @domName HTMLInputElement.setSelectionRange; @docsEditable true | 10413 /// @domName HTMLInputElement.setSelectionRange; @docsEditable true |
| 10391 void setSelectionRange(int start, int end, [String direction]) native; | 10414 void setSelectionRange(int start, int end, [String direction]) native; |
| 10392 | 10415 |
| 10393 /// @domName HTMLInputElement.stepDown; @docsEditable true | 10416 /// @domName HTMLInputElement.stepDown; @docsEditable true |
| 10394 void stepDown([int n]) native; | 10417 void stepDown([int n]) native; |
| 10395 | 10418 |
| 10396 /// @domName HTMLInputElement.stepUp; @docsEditable true | 10419 /// @domName HTMLInputElement.stepUp; @docsEditable true |
| 10397 void stepUp([int n]) native; | 10420 void stepUp([int n]) native; |
| 10398 } | 10421 |
| 10422 } |
| 10423 |
| 10424 |
| 10425 // Interfaces representing the InputElement APIs which are supported |
| 10426 // for the various types of InputElement. |
| 10427 // From http://dev.w3.org/html5/spec/the-input-element.html#the-input-element. |
| 10428 |
| 10429 /** |
| 10430 * Exposes the functionality common between all InputElement types. |
| 10431 */ |
| 10432 abstract class InputElementBase implements Element { |
| 10433 /// @domName HTMLInputElement.autofocus |
| 10434 bool autofocus; |
| 10435 |
| 10436 /// @domName HTMLInputElement.disabled |
| 10437 bool disabled; |
| 10438 |
| 10439 /// @domName HTMLInputElement.incremental |
| 10440 bool incremental; |
| 10441 |
| 10442 /// @domName HTMLInputElement.indeterminate |
| 10443 bool indeterminate; |
| 10444 |
| 10445 /// @domName HTMLInputElement.labels |
| 10446 List<Node> get labels; |
| 10447 |
| 10448 /// @domName HTMLInputElement.name |
| 10449 String name; |
| 10450 |
| 10451 /// @domName HTMLInputElement.validationMessage |
| 10452 String get validationMessage; |
| 10453 |
| 10454 /// @domName HTMLInputElement.validity |
| 10455 ValidityState get validity; |
| 10456 |
| 10457 /// @domName HTMLInputElement.value |
| 10458 String value; |
| 10459 |
| 10460 /// @domName HTMLInputElement.willValidate |
| 10461 bool get willValidate; |
| 10462 |
| 10463 /// @domName HTMLInputElement.checkValidity |
| 10464 bool checkValidity(); |
| 10465 |
| 10466 /// @domName HTMLInputElement.setCustomValidity |
| 10467 void setCustomValidity(String error); |
| 10468 } |
| 10469 |
| 10470 /** |
| 10471 * Hidden input which is not intended to be seen or edited by the user. |
| 10472 */ |
| 10473 abstract class HiddenInputElement implements Element { |
| 10474 factory HiddenInputElement() => new InputElement(type: 'hidden'); |
| 10475 } |
| 10476 |
| 10477 |
| 10478 /** |
| 10479 * Base interface for all inputs which involve text editing. |
| 10480 */ |
| 10481 abstract class TextInputElementBase implements InputElementBase { |
| 10482 /// @domName HTMLInputElement.autocomplete |
| 10483 String autocomplete; |
| 10484 |
| 10485 /// @domName HTMLInputElement.maxLength |
| 10486 int maxLength; |
| 10487 |
| 10488 /// @domName HTMLInputElement.pattern |
| 10489 String pattern; |
| 10490 |
| 10491 /// @domName HTMLInputElement.placeholder |
| 10492 String placeholder; |
| 10493 |
| 10494 /// @domName HTMLInputElement.readOnly |
| 10495 bool readOnly; |
| 10496 |
| 10497 /// @domName HTMLInputElement.required |
| 10498 bool required; |
| 10499 |
| 10500 /// @domName HTMLInputElement.size |
| 10501 int size; |
| 10502 |
| 10503 /// @domName HTMLInputElement.select |
| 10504 void select(); |
| 10505 |
| 10506 /// @domName HTMLInputElement.selectionDirection |
| 10507 String selectionDirection; |
| 10508 |
| 10509 /// @domName HTMLInputElement.selectionEnd |
| 10510 int selectionEnd; |
| 10511 |
| 10512 /// @domName HTMLInputElement.selectionStart |
| 10513 int selectionStart; |
| 10514 |
| 10515 /// @domName HTMLInputElement.setSelectionRange |
| 10516 void setSelectionRange(int start, int end, [String direction]); |
| 10517 } |
| 10518 |
| 10519 /** |
| 10520 * Similar to [TextInputElement], but on platforms where search is styled |
| 10521 * differently this will get the search style. |
| 10522 */ |
| 10523 abstract class SearchInputElement implements TextInputElementBase { |
| 10524 factory SearchInputElement() => new InputElement(type: 'search'); |
| 10525 |
| 10526 /// @domName HTMLInputElement.dirName; |
| 10527 String dirName; |
| 10528 |
| 10529 /// @domName HTMLInputElement.list; |
| 10530 Element get list; |
| 10531 } |
| 10532 |
| 10533 /** |
| 10534 * A basic text input editor control. |
| 10535 */ |
| 10536 abstract class TextInputElement implements TextInputElementBase { |
| 10537 factory TextInputElement() => new InputElement(type: 'text'); |
| 10538 |
| 10539 /// @domName HTMLInputElement.dirName; |
| 10540 String dirName; |
| 10541 |
| 10542 /// @domName HTMLInputElement.list; |
| 10543 Element get list; |
| 10544 } |
| 10545 |
| 10546 /** |
| 10547 * A control for editing an absolute URL. |
| 10548 */ |
| 10549 abstract class UrlInputElement implements TextInputElementBase { |
| 10550 factory UrlInputElement() => new InputElement(type: 'url'); |
| 10551 |
| 10552 /// @domName HTMLInputElement.list; |
| 10553 Element get list; |
| 10554 } |
| 10555 |
| 10556 /** |
| 10557 * Represents a control for editing a telephone number. |
| 10558 * |
| 10559 * This provides a single line of text with minimal formatting help since |
| 10560 * there is a wide variety of telephone numbers. |
| 10561 */ |
| 10562 abstract class TelephoneInputElement implements TextInputElementBase { |
| 10563 factory TelephoneInputElement() => new InputElement(type: 'tel'); |
| 10564 |
| 10565 /// @domName HTMLInputElement.list; |
| 10566 Element get list; |
| 10567 } |
| 10568 |
| 10569 /** |
| 10570 * An e-mail address or list of e-mail addresses. |
| 10571 */ |
| 10572 abstract class EmailInputElement implements TextInputElementBase { |
| 10573 factory EmailInputElement() => new InputElement(type: 'email'); |
| 10574 |
| 10575 /// @domName HTMLInputElement.autocomplete |
| 10576 String autocomplete; |
| 10577 |
| 10578 /// @domName HTMLInputElement.autofocus |
| 10579 bool autofocus; |
| 10580 |
| 10581 /// @domName HTMLInputElement.list; |
| 10582 Element get list; |
| 10583 |
| 10584 /// @domName HTMLInputElement.maxLength |
| 10585 int maxLength; |
| 10586 |
| 10587 /// @domName HTMLInputElement.multiple; |
| 10588 bool multiple; |
| 10589 |
| 10590 /// @domName HTMLInputElement.pattern |
| 10591 String pattern; |
| 10592 |
| 10593 /// @domName HTMLInputElement.placeholder |
| 10594 String placeholder; |
| 10595 |
| 10596 /// @domName HTMLInputElement.readOnly |
| 10597 bool readOnly; |
| 10598 |
| 10599 /// @domName HTMLInputElement.required |
| 10600 bool required; |
| 10601 |
| 10602 /// @domName HTMLInputElement.size |
| 10603 int size; |
| 10604 } |
| 10605 |
| 10606 /** |
| 10607 * Text with no line breaks (sensitive information). |
| 10608 */ |
| 10609 abstract class PasswordInputElement implements TextInputElementBase { |
| 10610 factory PasswordInputElement() => new InputElement(type: 'password'); |
| 10611 } |
| 10612 |
| 10613 /** |
| 10614 * Base interface for all input element types which involve ranges. |
| 10615 */ |
| 10616 abstract class RangeInputElementBase implements InputElementBase { |
| 10617 |
| 10618 /// @domName HTMLInputElement.list |
| 10619 Element get list; |
| 10620 |
| 10621 /// @domName HTMLInputElement.max |
| 10622 String max; |
| 10623 |
| 10624 /// @domName HTMLInputElement.min |
| 10625 String min; |
| 10626 |
| 10627 /// @domName HTMLInputElement.step |
| 10628 String step; |
| 10629 |
| 10630 /// @domName HTMLInputElement.valueAsNumber |
| 10631 num valueAsNumber; |
| 10632 |
| 10633 /// @domName HTMLInputElement.stepDown |
| 10634 void stepDown([int n]); |
| 10635 |
| 10636 /// @domName HTMLInputElement.stepUp |
| 10637 void stepUp([int n]); |
| 10638 } |
| 10639 |
| 10640 /** |
| 10641 * A date and time (year, month, day, hour, minute, second, fraction of a |
| 10642 * second) with the time zone set to UTC. |
| 10643 */ |
| 10644 abstract class DateTimeInputElement implements RangeInputElementBase { |
| 10645 factory DateTimeInputElement() => new InputElement(type: 'datetime'); |
| 10646 |
| 10647 /// @domName HTMLInputElement.valueAsDate |
| 10648 Date valueAsDate; |
| 10649 |
| 10650 /// @domName HTMLInputElement.readOnly |
| 10651 bool readOnly; |
| 10652 |
| 10653 /// @domName HTMLInputElement.required |
| 10654 bool required; |
| 10655 } |
| 10656 |
| 10657 /** |
| 10658 * A date (year, month, day) with no time zone. |
| 10659 */ |
| 10660 abstract class DateInputElement implements RangeInputElementBase { |
| 10661 factory DateInputElement() => new InputElement(type: 'date'); |
| 10662 |
| 10663 /// @domName HTMLInputElement.valueAsDate |
| 10664 Date valueAsDate; |
| 10665 |
| 10666 /// @domName HTMLInputElement.readOnly |
| 10667 bool readOnly; |
| 10668 |
| 10669 /// @domName HTMLInputElement.required |
| 10670 bool required; |
| 10671 } |
| 10672 |
| 10673 /** |
| 10674 * A date consisting of a year and a month with no time zone. |
| 10675 */ |
| 10676 abstract class MonthInputElement implements RangeInputElementBase { |
| 10677 factory MonthInputElement() => new InputElement(type: 'month'); |
| 10678 |
| 10679 /// @domName HTMLInputElement.valueAsDate |
| 10680 Date valueAsDate; |
| 10681 |
| 10682 /// @domName HTMLInputElement.readOnly |
| 10683 bool readOnly; |
| 10684 |
| 10685 /// @domName HTMLInputElement.required |
| 10686 bool required; |
| 10687 } |
| 10688 |
| 10689 /** |
| 10690 * A date consisting of a week-year number and a week number with no time zone. |
| 10691 */ |
| 10692 abstract class WeekInputElement implements RangeInputElementBase { |
| 10693 factory WeekInputElement() => new InputElement(type: 'week'); |
| 10694 |
| 10695 /// @domName HTMLInputElement.valueAsDate |
| 10696 Date valueAsDate; |
| 10697 |
| 10698 /// @domName HTMLInputElement.readOnly |
| 10699 bool readOnly; |
| 10700 |
| 10701 /// @domName HTMLInputElement.required |
| 10702 bool required; |
| 10703 } |
| 10704 |
| 10705 /** |
| 10706 * A time (hour, minute, seconds, fractional seconds) with no time zone. |
| 10707 */ |
| 10708 abstract class TimeInputElement implements RangeInputElementBase { |
| 10709 factory TimeInputElement() => new InputElement(type: 'time'); |
| 10710 |
| 10711 /// @domName HTMLInputElement.valueAsDate |
| 10712 Date valueAsDate; |
| 10713 |
| 10714 /// @domName HTMLInputElement.readOnly |
| 10715 bool readOnly; |
| 10716 |
| 10717 /// @domName HTMLInputElement.required |
| 10718 bool required; |
| 10719 } |
| 10720 |
| 10721 /** |
| 10722 * A date and time (year, month, day, hour, minute, second, fraction of a |
| 10723 * second) with no time zone. |
| 10724 */ |
| 10725 abstract class LocalDateTimeInputElement implements RangeInputElementBase { |
| 10726 factory LocalDateTimeInputElement() => |
| 10727 new InputElement(type: 'datetime-local'); |
| 10728 |
| 10729 /// @domName HTMLInputElement.readOnly |
| 10730 bool readOnly; |
| 10731 |
| 10732 /// @domName HTMLInputElement.required |
| 10733 bool required; |
| 10734 } |
| 10735 |
| 10736 /** |
| 10737 * A numeric editor control. |
| 10738 */ |
| 10739 abstract class NumberInputElement implements RangeInputElementBase { |
| 10740 factory NumberInputElement() => new InputElement(type: 'number'); |
| 10741 |
| 10742 /// @domName HTMLInputElement.placeholder |
| 10743 String placeholder; |
| 10744 |
| 10745 /// @domName HTMLInputElement.readOnly |
| 10746 bool readOnly; |
| 10747 |
| 10748 /// @domName HTMLInputElement.required |
| 10749 bool required; |
| 10750 } |
| 10751 |
| 10752 /** |
| 10753 * Similar to [NumberInputElement] but the browser may provide more optimal |
| 10754 * styling (such as a slider control). |
| 10755 */ |
| 10756 abstract class RangeInputElement implements RangeInputElementBase { |
| 10757 factory RangeInputElement() => new InputElement(type: 'range'); |
| 10758 } |
| 10759 |
| 10760 /** |
| 10761 * A boolean editor control. |
| 10762 * |
| 10763 * Note that if [indeterminate] is set then this control is in a third |
| 10764 * indeterminate state. |
| 10765 */ |
| 10766 abstract class CheckboxInputElement implements InputElementBase { |
| 10767 factory CheckboxInputElement() => new InputElement(type: 'checkbox'); |
| 10768 |
| 10769 /// @domName HTMLInputElement.checked |
| 10770 bool checked; |
| 10771 |
| 10772 /// @domName HTMLInputElement.required |
| 10773 bool required; |
| 10774 } |
| 10775 |
| 10776 |
| 10777 /** |
| 10778 * A control that when used with other [ReadioButtonInputElement] controls |
| 10779 * forms a radio button group in which only one control can be checked at a |
| 10780 * time. |
| 10781 * |
| 10782 * Radio buttons are considered to be in the same radio button group if: |
| 10783 * |
| 10784 * * They are all of type 'radio'. |
| 10785 * * They all have either the same [FormElement] owner, or no owner. |
| 10786 * * Their name attributes contain the same name. |
| 10787 */ |
| 10788 abstract class RadioButtonInputElement implements InputElementBase { |
| 10789 factory RadioButtonInputElement() => new InputElement(type: 'radio'); |
| 10790 |
| 10791 /// @domName HTMLInputElement.checked |
| 10792 bool checked; |
| 10793 |
| 10794 /// @domName HTMLInputElement.required |
| 10795 bool required; |
| 10796 } |
| 10797 |
| 10798 /** |
| 10799 * A control for picking files from the user's computer. |
| 10800 */ |
| 10801 abstract class FileUploadInputElement implements InputElementBase { |
| 10802 factory FileUploadInputElement() => new InputElement(type: 'file'); |
| 10803 |
| 10804 /// @domName HTMLInputElement.accept |
| 10805 String accept; |
| 10806 |
| 10807 /// @domName HTMLInputElement.multiple |
| 10808 bool multiple; |
| 10809 |
| 10810 /// @domName HTMLInputElement.required |
| 10811 bool required; |
| 10812 |
| 10813 /// @domName HTMLInputElement.files |
| 10814 List<File> files; |
| 10815 } |
| 10816 |
| 10817 /** |
| 10818 * A button, which when clicked, submits the form. |
| 10819 */ |
| 10820 abstract class SubmitButtonInputElement implements InputElementBase { |
| 10821 factory SubmitButtonInputElement() => new InputElement(type: 'submit'); |
| 10822 |
| 10823 /// @domName HTMLInputElement.formAction |
| 10824 String formAction; |
| 10825 |
| 10826 /// @domName HTMLInputElement.formEnctype |
| 10827 String formEnctype; |
| 10828 |
| 10829 /// @domName HTMLInputElement.formMethod |
| 10830 String formMethod; |
| 10831 |
| 10832 /// @domName HTMLInputElement.formNoValidate |
| 10833 bool formNoValidate; |
| 10834 |
| 10835 /// @domName HTMLInputElement.formTarget |
| 10836 String formTarget; |
| 10837 } |
| 10838 |
| 10839 abstract class ImageButtonInputElement implements InputElementBase { |
| 10840 factory ImageButtonInputElement() => new InputElement(type: 'image'); |
| 10841 |
| 10842 /// @domName HTMLInputElement.alt |
| 10843 String alt; |
| 10844 |
| 10845 /// @domName HTMLInputElement.formAction |
| 10846 String formAction; |
| 10847 |
| 10848 /// @domName HTMLInputElement.formEnctype |
| 10849 String formEnctype; |
| 10850 |
| 10851 /// @domName HTMLInputElement.formMethod |
| 10852 String formMethod; |
| 10853 |
| 10854 /// @domName HTMLInputElement.formNoValidate |
| 10855 bool formNoValidate; |
| 10856 |
| 10857 /// @domName HTMLInputElement.formTarget |
| 10858 String formTarget; |
| 10859 |
| 10860 /// @domName HTMLInputElement.height |
| 10861 int height; |
| 10862 |
| 10863 /// @domName HTMLInputElement.src |
| 10864 String src; |
| 10865 |
| 10866 /// @domName HTMLInputElement.width |
| 10867 int width; |
| 10868 } |
| 10869 |
| 10870 /** |
| 10871 * A button, which when clicked, resets the form. |
| 10872 */ |
| 10873 abstract class ResetButtonInputElement implements InputElementBase { |
| 10874 factory ResetButtonInputElement() => new InputElement(type: 'reset'); |
| 10875 } |
| 10876 |
| 10877 /** |
| 10878 * A button, with no default behavior. |
| 10879 */ |
| 10880 abstract class ButtonInputElement implements InputElementBase { |
| 10881 factory ButtonInputElement() => new InputElement(type: 'button'); |
| 10882 } |
| 10883 |
| 10399 | 10884 |
| 10400 class InputElementEvents extends ElementEvents { | 10885 class InputElementEvents extends ElementEvents { |
| 10401 InputElementEvents(EventTarget _ptr) : super(_ptr); | 10886 InputElementEvents(EventTarget _ptr) : super(_ptr); |
| 10402 | 10887 |
| 10403 EventListenerList get speechChange => this['webkitSpeechChange']; | 10888 EventListenerList get speechChange => this['webkitSpeechChange']; |
| 10404 } | 10889 } |
| 10405 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 10890 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 10406 // for details. All rights reserved. Use of this source code is governed by a | 10891 // for details. All rights reserved. Use of this source code is governed by a |
| 10407 // BSD-style license that can be found in the LICENSE file. | 10892 // BSD-style license that can be found in the LICENSE file. |
| 10408 | 10893 |
| (...skipping 14286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 24695 T next() { | 25180 T next() { |
| 24696 if (!hasNext) { | 25181 if (!hasNext) { |
| 24697 throw new StateError("No more elements"); | 25182 throw new StateError("No more elements"); |
| 24698 } | 25183 } |
| 24699 return _array[_pos++]; | 25184 return _array[_pos++]; |
| 24700 } | 25185 } |
| 24701 | 25186 |
| 24702 final List<T> _array; | 25187 final List<T> _array; |
| 24703 int _pos; | 25188 int _pos; |
| 24704 } | 25189 } |
| OLD | NEW |