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

Side by Side Diff: sdk/lib/html/dart2js/html_dart2js.dart

Issue 11478031: Fix KeyboardEvent constructor to default to empty string for keyIdentifier. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years 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 | « no previous file | sdk/lib/html/dartium/html_dartium.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 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 5530 matching lines...) Expand 10 before | Expand all | Expand 10 after
5541 5541
5542 /// @domName DirectoryReaderSync.readEntries; @docsEditable true 5542 /// @domName DirectoryReaderSync.readEntries; @docsEditable true
5543 @Returns('_EntryArraySync') @Creates('_EntryArraySync') 5543 @Returns('_EntryArraySync') @Creates('_EntryArraySync')
5544 List<EntrySync> readEntries() native; 5544 List<EntrySync> readEntries() native;
5545 } 5545 }
5546 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 5546 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
5547 // for details. All rights reserved. Use of this source code is governed by a 5547 // for details. All rights reserved. Use of this source code is governed by a
5548 // BSD-style license that can be found in the LICENSE file. 5548 // BSD-style license that can be found in the LICENSE file.
5549 5549
5550 5550
5551 /**
5552 * Represents an HTML <div> element.
Emily Fortuna 2012/12/07 20:23:24 This is "deleted" between the apidoc generator is
5553 *
5554 * The [DivElement] is a generic container for content and does not have any
5555 * special significance. It is functionally similar to [SpanElement].
5556 *
5557 * The [DivElement] is a block-level element, as opposed to [SpanElement],
5558 * which is an inline-level element.
5559 *
5560 * Example usage:
5561 *
5562 * DivElement div = new DivElement();
5563 * div.text = 'Here's my new DivElem
5564 * document.body.elements.add(elem);
5565 *
5566 * See also:
5567 *
5568 * * [HTML <div> element](http://www.w3.org/TR/html-markup/div.html) from W3C.
5569 * * [Block-level element](http://www.w3.org/TR/CSS2/visuren.html#block-boxes) f rom W3C.
5570 * * [Inline-level element](http://www.w3.org/TR/CSS2/visuren.html#inline-boxes) from W3C.
5571 */
5572 /// @domName HTMLDivElement; @docsEditable true 5551 /// @domName HTMLDivElement; @docsEditable true
5573 class DivElement extends Element implements Element native "*HTMLDivElement" { 5552 class DivElement extends Element implements Element native "*HTMLDivElement" {
5574 5553
5575 ///@docsEditable true 5554 ///@docsEditable true
5576 factory DivElement() => document.$dom_createElement("div"); 5555 factory DivElement() => document.$dom_createElement("div");
5577 } 5556 }
5578 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 5557 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
5579 // for details. All rights reserved. Use of this source code is governed by a 5558 // for details. All rights reserved. Use of this source code is governed by a
5580 // BSD-style license that can be found in the LICENSE file. 5559 // BSD-style license that can be found in the LICENSE file.
5581 5560
(...skipping 19 matching lines...) Expand all
5601 /// @domName Document.body; @docsEditable true 5580 /// @domName Document.body; @docsEditable true
5602 @JSName('body') 5581 @JSName('body')
5603 Element $dom_body; 5582 Element $dom_body;
5604 5583
5605 /// @domName Document.charset; @docsEditable true 5584 /// @domName Document.charset; @docsEditable true
5606 String charset; 5585 String charset;
5607 5586
5608 /// @domName Document.cookie; @docsEditable true 5587 /// @domName Document.cookie; @docsEditable true
5609 String cookie; 5588 String cookie;
5610 5589
5611 /// Returns the [Window] associated with the document.
5612 /// @domName Document.defaultView; @docsEditable true 5590 /// @domName Document.defaultView; @docsEditable true
5613 Window get window => _convertNativeToDart_Window(this._window); 5591 Window get window => _convertNativeToDart_Window(this._window);
5614 @JSName('defaultView') 5592 @JSName('defaultView')
5615 @Creates('LocalWindow|=Object') @Returns('LocalWindow|=Object') 5593 @Creates('LocalWindow|=Object') @Returns('LocalWindow|=Object')
5616 final dynamic _window; 5594 final dynamic _window;
5617 5595
5618 /// @domName Document.documentElement; @docsEditable true 5596 /// @domName Document.documentElement; @docsEditable true
5619 final Element documentElement; 5597 final Element documentElement;
5620 5598
5621 /// @domName Document.domain; @docsEditable true 5599 /// @domName Document.domain; @docsEditable true
(...skipping 4106 matching lines...) Expand 10 before | Expand all | Expand 10 after
9728 * [onComplete] callback. 9706 * [onComplete] callback.
9729 * 9707 *
9730 * See also: (authorization headers)[http://en.wikipedia.org/wiki/Basic_access _authentication]. 9708 * See also: (authorization headers)[http://en.wikipedia.org/wiki/Basic_access _authentication].
9731 */ 9709 */
9732 factory HttpRequest.getWithCredentials(String url, 9710 factory HttpRequest.getWithCredentials(String url,
9733 onComplete(HttpRequest request)) => 9711 onComplete(HttpRequest request)) =>
9734 _HttpRequestFactoryProvider.createHttpRequest_getWithCredentials(url, 9712 _HttpRequestFactoryProvider.createHttpRequest_getWithCredentials(url,
9735 onComplete); 9713 onComplete);
9736 9714
9737 9715
9738 /**
9739 * General constructor for any type of request (GET, POST, etc).
9740 *
9741 * This call is used in conjunction with [open]:
9742 *
9743 * var request = new HttpRequest();
9744 * request.open('GET', 'http://dartlang.org')
9745 * request.on.load.add((event) => print('Request complete'));
9746 *
9747 * is the (more verbose) equivalent of
9748 *
9749 * var request = new HttpRequest.get('http://dartlang.org', (event) => pri nt('Request complete'));
9750 */
9751 ///@docsEditable true 9716 ///@docsEditable true
9752 factory HttpRequest() => _HttpRequestFactoryProvider.createHttpRequest(); 9717 factory HttpRequest() => _HttpRequestFactoryProvider.createHttpRequest();
9753 9718
9754 /**
9755 * Get the set of [HttpRequestEvents] that this request can respond to.
9756 * Usually used when adding an EventListener, such as in
9757 * `document.window.on.keyDown.add((e) => print('keydown happened'))`.
9758 */
9759 /// @domName EventTarget.addEventListener, EventTarget.removeEventListener, Ev entTarget.dispatchEvent; @docsEditable true 9719 /// @domName EventTarget.addEventListener, EventTarget.removeEventListener, Ev entTarget.dispatchEvent; @docsEditable true
9760 HttpRequestEvents get on => 9720 HttpRequestEvents get on =>
9761 new HttpRequestEvents(this); 9721 new HttpRequestEvents(this);
9762 9722
9763 static const int DONE = 4; 9723 static const int DONE = 4;
9764 9724
9765 static const int HEADERS_RECEIVED = 2; 9725 static const int HEADERS_RECEIVED = 2;
9766 9726
9767 static const int LOADING = 3; 9727 static const int LOADING = 3;
9768 9728
9769 static const int OPENED = 1; 9729 static const int OPENED = 1;
9770 9730
9771 static const int UNSENT = 0; 9731 static const int UNSENT = 0;
9772 9732
9773 /** @domName XMLHttpRequest.readyState */
9774 /// @domName XMLHttpRequest.readyState; @docsEditable true 9733 /// @domName XMLHttpRequest.readyState; @docsEditable true
9775 final int readyState; 9734 final int readyState;
9776 9735
9777 /**
9778 * The data received as a reponse from the request.
9779 *
9780 * The data could be in the
9781 * form of a [String], [ArrayBuffer], [Document], [Blob], or json (also a
9782 * [String]). `null` indicates request failure.
9783 */
9784 /// @domName XMLHttpRequest.response; @docsEditable true 9736 /// @domName XMLHttpRequest.response; @docsEditable true
9785 @Creates('ArrayBuffer|Blob|Document|=Object|=List|String|num') 9737 @Creates('ArrayBuffer|Blob|Document|=Object|=List|String|num')
9786 final Object response; 9738 final Object response;
9787 9739
9788 /**
9789 * The response in string form or `null` on failure.
9790 */
9791 /// @domName XMLHttpRequest.responseText; @docsEditable true 9740 /// @domName XMLHttpRequest.responseText; @docsEditable true
9792 final String responseText; 9741 final String responseText;
9793 9742
9794 /**
9795 * [String] telling the server the desired response format.
9796 *
9797 * Default is `String`.
9798 * Other options are one of 'arraybuffer', 'blob', 'document', 'json',
9799 * 'text'. Some newer browsers will throw NS_ERROR_DOM_INVALID_ACCESS_ERR if
9800 * `responseType` is set while performing a synchronous request.
9801 *
9802 * See also: [MDN responseType](https://developer.mozilla.org/en-US/docs/DOM/X MLHttpRequest#responseType)
9803 */
9804 /// @domName XMLHttpRequest.responseType; @docsEditable true 9743 /// @domName XMLHttpRequest.responseType; @docsEditable true
9805 String responseType; 9744 String responseType;
9806 9745
9807 /// @domName XMLHttpRequest.responseXML; @docsEditable true 9746 /// @domName XMLHttpRequest.responseXML; @docsEditable true
9808 @JSName('responseXML') 9747 @JSName('responseXML')
9809 final Document responseXml; 9748 final Document responseXml;
9810 9749
9811 /**
9812 * The http result code from the request (200, 404, etc).
9813 * See also: [Http Status Codes](http://en.wikipedia.org/wiki/List_of_HTTP_sta tus_codes)
9814 */
9815 /// @domName XMLHttpRequest.status; @docsEditable true 9750 /// @domName XMLHttpRequest.status; @docsEditable true
9816 final int status; 9751 final int status;
9817 9752
9818 /**
9819 * The request response string (such as "200 OK").
9820 * See also: [Http Status Codes](http://en.wikipedia.org/wiki/List_of_HTTP_sta tus_codes)
9821 */
9822 /// @domName XMLHttpRequest.statusText; @docsEditable true 9753 /// @domName XMLHttpRequest.statusText; @docsEditable true
9823 final String statusText; 9754 final String statusText;
9824 9755
9825 /**
9826 * [EventTarget] that can hold listeners to track the progress of the request.
9827 * The events fired will be members of [HttpRequestUploadEvents].
9828 */
9829 /// @domName XMLHttpRequest.upload; @docsEditable true 9756 /// @domName XMLHttpRequest.upload; @docsEditable true
9830 final HttpRequestUpload upload; 9757 final HttpRequestUpload upload;
9831 9758
9832 /**
9833 * True if cross-site requests should use credentials such as cookies
9834 * or authorization headers; false otherwise.
9835 *
9836 * This value is ignored for same-site requests.
9837 */
9838 /// @domName XMLHttpRequest.withCredentials; @docsEditable true 9759 /// @domName XMLHttpRequest.withCredentials; @docsEditable true
9839 bool withCredentials; 9760 bool withCredentials;
9840 9761
9841 /**
9842 * Stop the current request.
9843 *
9844 * The request can only be stopped if readyState is `HEADERS_RECIEVED` or
9845 * `LOADING`. If this method is not in the process of being sent, the method
9846 * has no effect.
9847 */
9848 /// @domName XMLHttpRequest.abort; @docsEditable true 9762 /// @domName XMLHttpRequest.abort; @docsEditable true
9849 void abort() native; 9763 void abort() native;
9850 9764
9851 /// @domName XMLHttpRequest.addEventListener; @docsEditable true 9765 /// @domName XMLHttpRequest.addEventListener; @docsEditable true
9852 @JSName('addEventListener') 9766 @JSName('addEventListener')
9853 void $dom_addEventListener(String type, EventListener listener, [bool useCaptu re]) native; 9767 void $dom_addEventListener(String type, EventListener listener, [bool useCaptu re]) native;
9854 9768
9855 /// @domName XMLHttpRequest.dispatchEvent; @docsEditable true 9769 /// @domName XMLHttpRequest.dispatchEvent; @docsEditable true
9856 @JSName('dispatchEvent') 9770 @JSName('dispatchEvent')
9857 bool $dom_dispatchEvent(Event evt) native; 9771 bool $dom_dispatchEvent(Event evt) native;
9858 9772
9859 /**
9860 * Retrieve all the response headers from a request.
9861 *
9862 * `null` if no headers have been received. For multipart requests,
9863 * `getAllResponseHeaders` will return the response headers for the current
9864 * part of the request.
9865 *
9866 * See also [HTTP response headers](http://en.wikipedia.org/wiki/List_of_HTTP_ header_fields#Responses)
9867 * for a list of common response headers.
9868 */
9869 /// @domName XMLHttpRequest.getAllResponseHeaders; @docsEditable true 9773 /// @domName XMLHttpRequest.getAllResponseHeaders; @docsEditable true
9870 String getAllResponseHeaders() native; 9774 String getAllResponseHeaders() native;
9871 9775
9872 /**
9873 * Return the response header named `header`, or `null` if not found.
9874 *
9875 * See also [HTTP response headers](http://en.wikipedia.org/wiki/List_of_HTTP_ header_fields#Responses)
9876 * for a list of common response headers.
9877 */
9878 /// @domName XMLHttpRequest.getResponseHeader; @docsEditable true 9776 /// @domName XMLHttpRequest.getResponseHeader; @docsEditable true
9879 String getResponseHeader(String header) native; 9777 String getResponseHeader(String header) native;
9880 9778
9881 /**
9882 * Specify the desired `url`, and `method` to use in making the request.
9883 *
9884 * By default the request is done asyncronously, with no user or password
9885 * authentication information. If `async` is false, the request will be send
9886 * synchronously.
9887 *
9888 * Calling `open` again on a currently active request is equivalent to
9889 * calling `abort`.
9890 */
9891 /// @domName XMLHttpRequest.open; @docsEditable true 9779 /// @domName XMLHttpRequest.open; @docsEditable true
9892 void open(String method, String url, [bool async, String user, String password ]) native; 9780 void open(String method, String url, [bool async, String user, String password ]) native;
9893 9781
9894 /**
9895 * Specify a particular MIME type (such as `text/xml`) desired for the
9896 * response.
9897 *
9898 * This value must be set before the request has been sent. See also the list
9899 * of [common MIME types](http://en.wikipedia.org/wiki/Internet_media_type#Lis t_of_common_media_types)
9900 */
9901 /// @domName XMLHttpRequest.overrideMimeType; @docsEditable true 9782 /// @domName XMLHttpRequest.overrideMimeType; @docsEditable true
9902 void overrideMimeType(String override) native; 9783 void overrideMimeType(String override) native;
9903 9784
9904 /// @domName XMLHttpRequest.removeEventListener; @docsEditable true 9785 /// @domName XMLHttpRequest.removeEventListener; @docsEditable true
9905 @JSName('removeEventListener') 9786 @JSName('removeEventListener')
9906 void $dom_removeEventListener(String type, EventListener listener, [bool useCa pture]) native; 9787 void $dom_removeEventListener(String type, EventListener listener, [bool useCa pture]) native;
9907 9788
9908 /**
9909 * Send the request with any given `data`.
9910 *
9911 * See also:
9912 * [send() docs](https://developer.mozilla.org/en-US/docs/DOM/XMLHttpRequest#s end())
9913 * from MDN.
9914 */
9915 /// @domName XMLHttpRequest.send; @docsEditable true 9789 /// @domName XMLHttpRequest.send; @docsEditable true
9916 void send([data]) native; 9790 void send([data]) native;
9917 9791
9918 /** Sets HTTP `header` to `value`. */
9919 /// @domName XMLHttpRequest.setRequestHeader; @docsEditable true 9792 /// @domName XMLHttpRequest.setRequestHeader; @docsEditable true
9920 void setRequestHeader(String header, String value) native; 9793 void setRequestHeader(String header, String value) native;
9921 9794
9922 } 9795 }
9923 9796
9924 class HttpRequestEvents extends Events { 9797 class HttpRequestEvents extends Events {
9925 HttpRequestEvents(EventTarget _ptr) : super(_ptr); 9798 HttpRequestEvents(EventTarget _ptr) : super(_ptr);
9926 9799
9927 EventListenerList get abort => this['abort']; 9800 EventListenerList get abort => this['abort'];
9928 9801
(...skipping 887 matching lines...) Expand 10 before | Expand all | Expand 10 after
10816 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 10689 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
10817 // for details. All rights reserved. Use of this source code is governed by a 10690 // for details. All rights reserved. Use of this source code is governed by a
10818 // BSD-style license that can be found in the LICENSE file. 10691 // BSD-style license that can be found in the LICENSE file.
10819 10692
10820 10693
10821 /// @domName KeyboardEvent; @docsEditable true 10694 /// @domName KeyboardEvent; @docsEditable true
10822 class KeyboardEvent extends UIEvent native "*KeyboardEvent" { 10695 class KeyboardEvent extends UIEvent native "*KeyboardEvent" {
10823 10696
10824 factory KeyboardEvent(String type, Window view, 10697 factory KeyboardEvent(String type, Window view,
10825 [bool canBubble = true, bool cancelable = true, 10698 [bool canBubble = true, bool cancelable = true,
10826 String keyIdentifier = null, int keyLocation = 1, bool ctrlKey = false, 10699 String keyIdentifier = "", int keyLocation = 1, bool ctrlKey = false,
10827 bool altKey = false, bool shiftKey = false, bool metaKey = false, 10700 bool altKey = false, bool shiftKey = false, bool metaKey = false,
10828 bool altGraphKey = false]) { 10701 bool altGraphKey = false]) {
10829 final e = document.$dom_createEvent("KeyboardEvent"); 10702 final e = document.$dom_createEvent("KeyboardEvent");
10830 e.$dom_initKeyboardEvent(type, canBubble, cancelable, view, keyIdentifier, 10703 e.$dom_initKeyboardEvent(type, canBubble, cancelable, view, keyIdentifier,
10831 keyLocation, ctrlKey, altKey, shiftKey, metaKey, altGraphKey); 10704 keyLocation, ctrlKey, altKey, shiftKey, metaKey, altGraphKey);
10832 return e; 10705 return e;
10833 } 10706 }
10834 10707
10835 /** @domName KeyboardEvent.initKeyboardEvent */ 10708 /** @domName KeyboardEvent.initKeyboardEvent */
10836 void $dom_initKeyboardEvent(String type, bool canBubble, bool cancelable, 10709 void $dom_initKeyboardEvent(String type, bool canBubble, bool cancelable,
(...skipping 1553 matching lines...) Expand 10 before | Expand all | Expand 10 after
12390 final int totalJSHeapSize; 12263 final int totalJSHeapSize;
12391 12264
12392 /// @domName MemoryInfo.usedJSHeapSize; @docsEditable true 12265 /// @domName MemoryInfo.usedJSHeapSize; @docsEditable true
12393 final int usedJSHeapSize; 12266 final int usedJSHeapSize;
12394 } 12267 }
12395 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 12268 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
12396 // for details. All rights reserved. Use of this source code is governed by a 12269 // for details. All rights reserved. Use of this source code is governed by a
12397 // BSD-style license that can be found in the LICENSE file. 12270 // BSD-style license that can be found in the LICENSE file.
12398 12271
12399 12272
12400 /**
12401 * An HTML <menu> element.
12402 *
12403 * A <menu> element represents an unordered list of menu commands.
12404 *
12405 * See also:
12406 *
12407 * * [Menu Element](https://developer.mozilla.org/en-US/docs/HTML/Element/menu) from MDN.
12408 * * [Menu Element](http://www.w3.org/TR/html5/the-menu-element.html#the-menu-e lement) from the W3C.
12409 */
12410 /// @domName HTMLMenuElement; @docsEditable true 12273 /// @domName HTMLMenuElement; @docsEditable true
12411 class MenuElement extends Element implements Element native "*HTMLMenuElement" { 12274 class MenuElement extends Element implements Element native "*HTMLMenuElement" {
12412 12275
12413 ///@docsEditable true 12276 ///@docsEditable true
12414 factory MenuElement() => document.$dom_createElement("menu"); 12277 factory MenuElement() => document.$dom_createElement("menu");
12415 } 12278 }
12416 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 12279 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
12417 // for details. All rights reserved. Use of this source code is governed by a 12280 // for details. All rights reserved. Use of this source code is governed by a
12418 // BSD-style license that can be found in the LICENSE file. 12281 // BSD-style license that can be found in the LICENSE file.
12419 12282
(...skipping 12252 matching lines...) Expand 10 before | Expand all | Expand 10 after
24672 T next() { 24535 T next() {
24673 if (!hasNext) { 24536 if (!hasNext) {
24674 throw new StateError("No more elements"); 24537 throw new StateError("No more elements");
24675 } 24538 }
24676 return _array[_pos++]; 24539 return _array[_pos++];
24677 } 24540 }
24678 24541
24679 final List<T> _array; 24542 final List<T> _array;
24680 int _pos; 24543 int _pos;
24681 } 24544 }
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/html/dartium/html_dartium.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698