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

Side by Side Diff: tools/dom/templates/html/impl/impl_EventTarget.darttemplate

Issue 29843004: Allow all events to be accessed via on[foo] instead of just onFoo (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 months 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 | « sdk/lib/html/dartium/html_dartium.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of $LIBRARYNAME; 5 part of $LIBRARYNAME;
6 6
7 /** 7 /**
8 * Base class that supports listening for and dispatching browser events. 8 * Base class that supports listening for and dispatching browser events.
9 * 9 *
10 * Normally events are accessed via the Stream getter: 10 * Normally events are accessed via the Stream getter:
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 Events(this._ptr); 47 Events(this._ptr);
48 48
49 Stream operator [](String type) { 49 Stream operator [](String type) {
50 return new _EventStream(_ptr, type, false); 50 return new _EventStream(_ptr, type, false);
51 } 51 }
52 } 52 }
53 53
54 class ElementEvents extends Events { 54 class ElementEvents extends Events {
55 /* Raw event target. */ 55 /* Raw event target. */
56 final Element _ptr; 56 final Element _ptr;
57 static final webkitEvents = {
58 'fullscreenchange' : 'onwebkitfullscreenchange',
blois 2013/10/19 01:19:10 the on prefix should not be there.
Emily Fortuna 2013/10/21 17:43:51 Done.
59 'fullscreenerror' : 'onwebkitfullscreenerror',
60 'pointerlockchange' : 'onwebkitpointerlockchange',
61 'pointerlockerror' : 'onwebkitpointerlockerror',
62 'keyadded' : 'onwebkitkeyadded',
blois 2013/10/19 01:19:10 Can we only add the webkit prefix on webkit browse
Emily Fortuna 2013/10/21 17:43:51 Done.
63 'keyerror' : 'onwebkitkeyerror',
64 'keymessage' : 'onwebkitkeymessage',
65 'needkey' : 'onwebkitneedkey',
66 'resourcetimingbufferfull' : 'onwebkitresourcetimingbufferfull',
blois 2013/10/19 01:19:10 Looking at this list, there are more renames- http
Emily Fortuna 2013/10/21 17:43:51 I think those other events much have gone away. I
67 'animationend' : 'onwebkitAnimationEnd',
68 'animationiteration' : 'onwebkitAnimationIteration',
69 'animationstart' : 'onwebkitAnimationStart',
Emily Fortuna 2013/10/19 00:57:31 it seemed unrealistic to expect the user to know t
70 'speechchange' : 'onwebkitSpeechChange'
71 };
57 72
58 ElementEvents(Element ptr) : this._ptr = ptr, super(ptr); 73 ElementEvents(Element ptr) : this._ptr = ptr, super(ptr);
59 74
60 Stream operator [](String type) { 75 Stream operator [](String type) {
76 if (type.toLowerCase() in webkitEvents.keys) {
77 return new _ElementEventStreamImpl(
78 _ptr, webkitEvents[type.toLowerCase()], false);
79 }
61 return new _ElementEventStreamImpl(_ptr, type, false); 80 return new _ElementEventStreamImpl(_ptr, type, false);
62 } 81 }
63 } 82 }
64 83
65 /** 84 /**
66 * Base class for all browser objects that support events. 85 * Base class for all browser objects that support events.
67 * 86 *
68 * Use the [on] property to add, and remove events (rather than 87 * Use the [on] property to add, and remove events (rather than
69 * [$dom_addEventListener] and [$dom_removeEventListener] 88 * [$dom_addEventListener] and [$dom_removeEventListener]
70 * for compile-time type checks and a more concise API. 89 * for compile-time type checks and a more concise API.
71 */ 90 */
72 $(ANNOTATIONS)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC { 91 $(ANNOTATIONS)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC {
73 92
74 // Custom element created callback. 93 // Custom element created callback.
75 EventTarget._created(); 94 EventTarget._created();
76 95
77 /** 96 /**
78 * This is an ease-of-use accessor for event streams which should only be 97 * This is an ease-of-use accessor for event streams which should only be
79 * used when an explicit accessor is not available. 98 * used when an explicit accessor is not available.
80 */ 99 */
81 Events get on => new Events(this); 100 Events get on => new Events(this);
82 $!MEMBERS 101 $!MEMBERS
83 } 102 }
OLDNEW
« no previous file with comments | « sdk/lib/html/dartium/html_dartium.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698