OLD | NEW |
1 /** | 1 /** |
2 * A custom KeyboardEvent that attempts to eliminate cross-browser | 2 * A custom KeyboardEvent that attempts to eliminate cross-browser |
3 * inconsistencies, and also provide both keyCode and charCode information | 3 * inconsistencies, and also provide both keyCode and charCode information |
4 * for all key events (when such information can be determined). | 4 * for all key events (when such information can be determined). |
5 * | 5 * |
6 * KeyEvent tries to provide a higher level, more polished keyboard event | 6 * KeyEvent tries to provide a higher level, more polished keyboard event |
7 * information on top of the "raw" [KeyboardEvent]. | 7 * information on top of the "raw" [KeyboardEvent]. |
8 * | 8 * |
9 * The mechanics of using KeyEvents is a little different from the underlying | 9 * The mechanics of using KeyEvents is a little different from the underlying |
10 * [KeyboardEvent]. To use KeyEvents, you need to create a stream and then add | 10 * [KeyboardEvent]. To use KeyEvents, you need to create a stream and then add |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 EventTarget currentTarget}) { | 99 EventTarget currentTarget}) { |
100 if (view == null) { | 100 if (view == null) { |
101 view = window; | 101 view = window; |
102 } | 102 } |
103 | 103 |
104 var eventObj; | 104 var eventObj; |
105 // In these two branches we create an underlying native KeyboardEvent, but | 105 // In these two branches we create an underlying native KeyboardEvent, but |
106 // we set it with our specified values. Because we are doing custom setting | 106 // we set it with our specified values. Because we are doing custom setting |
107 // of certain values (charCode/keyCode, etc) only in this class (as opposed | 107 // of certain values (charCode/keyCode, etc) only in this class (as opposed |
108 // to KeyboardEvent) and the way we set these custom values depends on the | 108 // to KeyboardEvent) and the way we set these custom values depends on the |
109 // type of underlying JS object, we do all the contruction for the | 109 // type of underlying JS object, we do all the construction for the |
110 // underlying KeyboardEvent here. | 110 // underlying KeyboardEvent here. |
111 if (canUseDispatchEvent) { | 111 if (canUseDispatchEvent) { |
112 // Currently works in everything but Internet Explorer. | 112 // Currently works in everything but Internet Explorer. |
113 eventObj = new Event.eventType('Event', type, | 113 eventObj = new Event.eventType('Event', type, |
114 canBubble: canBubble, cancelable: cancelable); | 114 canBubble: canBubble, cancelable: cancelable); |
115 | 115 |
116 JS('void', '#.keyCode = #', eventObj, keyCode); | 116 JS('void', '#.keyCode = #', eventObj, keyCode); |
117 JS('void', '#.which = #', eventObj, keyCode); | 117 JS('void', '#.which = #', eventObj, keyCode); |
118 JS('void', '#.charCode = #', eventObj, charCode); | 118 JS('void', '#.charCode = #', eventObj, charCode); |
119 | 119 |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 } | 249 } |
250 | 250 |
251 @Experimental() // untriaged | 251 @Experimental() // untriaged |
252 bool getModifierState(String keyArgument) => throw new UnimplementedError(); | 252 bool getModifierState(String keyArgument) => throw new UnimplementedError(); |
253 @Experimental() // untriaged | 253 @Experimental() // untriaged |
254 int get location => throw new UnimplementedError(); | 254 int get location => throw new UnimplementedError(); |
255 @Experimental() // untriaged | 255 @Experimental() // untriaged |
256 bool get repeat => throw new UnimplementedError(); | 256 bool get repeat => throw new UnimplementedError(); |
257 dynamic get _get_view => throw new UnimplementedError(); | 257 dynamic get _get_view => throw new UnimplementedError(); |
258 } | 258 } |
OLD | NEW |