OLD | NEW |
---|---|
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 part of $LIBRARYNAME; | 4 part of $LIBRARYNAME; |
5 | 5 |
6 | 6 |
7 $(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS { | 7 $(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS { |
8 | 8 |
9 factory $CLASSNAME(String type, | 9 factory $CLASSNAME(String type, { |
10 {Window view, bool canBubble: true, bool cancelable: true, | 10 Window view, |
11 int location: 1, bool ctrlKey: false, | 11 bool canBubble: true, |
12 bool altKey: false, bool shiftKey: false, bool metaKey: false}) { | 12 bool cancelable: true, |
13 int location, | |
14 int keyLocation, // Legacy alias for location | |
Jacob
2017/05/15 17:12:06
Nit: end comments with a period. Here and in the o
| |
15 bool ctrlKey: false, | |
16 bool altKey: false, | |
17 bool shiftKey: false, | |
18 bool metaKey: false}) { | |
13 if (view == null) { | 19 if (view == null) { |
14 view = window; | 20 view = window; |
15 } | 21 } |
22 location ??= keyLocation ?? 1; | |
16 final e = document._createEvent("KeyboardEvent"); | 23 final e = document._createEvent("KeyboardEvent"); |
17 e._initKeyboardEvent(type, canBubble, cancelable, view, "", | 24 e._initKeyboardEvent(type, canBubble, cancelable, view, "", |
18 location, ctrlKey, altKey, shiftKey, metaKey); | 25 location, ctrlKey, altKey, shiftKey, metaKey); |
19 return e; | 26 return e; |
20 } | 27 } |
21 | 28 |
22 @DomName('KeyboardEvent.keyCode') | 29 @DomName('KeyboardEvent.keyCode') |
23 int get keyCode => _keyCode; | 30 int get keyCode => _keyCode; |
24 | 31 |
25 @DomName('KeyboardEvent.charCode') | 32 @DomName('KeyboardEvent.charCode') |
26 int get charCode => _charCode; | 33 int get charCode => _charCode; |
27 | 34 |
28 @DomName('KeyboardEvent.which') | 35 @DomName('KeyboardEvent.which') |
29 int get which => _which; | 36 int get which => _which; |
30 $!MEMBERS | 37 $!MEMBERS |
31 } | 38 } |
OLD | NEW |