Index: sdk/lib/html/dart2js/html_dart2js.dart |
diff --git a/sdk/lib/html/dart2js/html_dart2js.dart b/sdk/lib/html/dart2js/html_dart2js.dart |
index 09f9f04a2c80669806c812e68ce538697551ddf3..3105b0c0a55d5fef0c8b187b89b051aba66a28b1 100644 |
--- a/sdk/lib/html/dart2js/html_dart2js.dart |
+++ b/sdk/lib/html/dart2js/html_dart2js.dart |
@@ -10890,13 +10890,20 @@ class KeyboardEvent extends UIEvent native "*KeyboardEvent" { |
void $dom_initKeyboardEvent(String type, bool canBubble, bool cancelable, |
LocalWindow view, String keyIdentifier, int keyLocation, bool ctrlKey, |
bool altKey, bool shiftKey, bool metaKey, bool altGraphKey) { |
- // initKeyEvent is the call in Firefox, initKeyboardEvent for all other |
- // browsers. |
- var function = JS('dynamic', '#.initKeyboardEvent || #.initKeyEvent', this, |
- this); |
- JS('void', '#(#, #, #, #, #, #, #, #, #, #, #)', function, type, |
- canBubble, cancelable, view, keyIdentifier, keyLocation, ctrlKey, |
- altKey, shiftKey, metaKey, altGraphKey); |
+ if (JS('bool', 'typeof(#.initKeyEvent) == "function"', this)) { |
+ // initKeyEvent is only in Firefox (instead of initKeyboardEvent). It has |
+ // a slightly different signature, and allows you to specify keyCode and |
+ // charCode as the last two arguments, but we just set them as the default |
+ // since they can't be specified in other browsers. |
+ JS('void', '#.initKeyEvent(#, #, #, #, #, #, #, #, 0, 0)', this, |
+ type, canBubble, cancelable, view, |
+ ctrlKey, altKey, shiftKey, metaKey); |
+ } else { |
+ // initKeyboardEvent is for all other browsers. |
+ JS('void', '#.initKeyboardEvent(#, #, #, #, #, #, #, #, #, #, #)', this, |
+ type, canBubble, cancelable, view, keyIdentifier, keyLocation, |
+ ctrlKey, altKey, shiftKey, metaKey, altGraphKey); |
+ } |
} |
/** @domName KeyboardEvent.keyCode */ |
@@ -21950,7 +21957,7 @@ class KeyboardEventController { |
EventTarget _target; |
// The distance to shift from upper case alphabet Roman letters to lower case. |
- int _ROMAN_ALPHABET_OFFSET = "a".charCodes[0] - "A".charCodes[0]; |
+ final int _ROMAN_ALPHABET_OFFSET = "a".charCodes[0] - "A".charCodes[0]; |
// Instance members referring to the internal event handlers because closures |
// are not hashable. |