Index: tools/dom/templates/html/impl/impl_Event.darttemplate |
diff --git a/tools/dom/templates/html/impl/impl_Event.darttemplate b/tools/dom/templates/html/impl/impl_Event.darttemplate |
index 9fddd1c56b5a5d99b7f5bc8c4f02cb4f6178b5d8..0ca534a19839ddc03ca8991508685be7ba827d9e 100644 |
--- a/tools/dom/templates/html/impl/impl_Event.darttemplate |
+++ b/tools/dom/templates/html/impl/impl_Event.darttemplate |
@@ -13,7 +13,24 @@ $(ANNOTATIONS)class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC { |
// |
// Contrary to JS, we default canBubble and cancelable to true, since that's |
// what people want most of the time anyway. |
- factory $CLASSNAME(String type, [bool canBubble = true, bool cancelable = true]) => |
- _$(CLASSNAME)FactoryProvider.create$CLASSNAME(type, canBubble, cancelable); |
+ factory $CLASSNAME(String type, |
+ [bool canBubble = true, bool cancelable = true]) { |
+ return new Event.eventType('Event', type, canBubble, cancelable); |
+ } |
+ |
+ /** |
+ * Creates a new Event object of the specified type. |
+ * |
+ * This is analogous to document.createEvent. |
+ * Normally events should be created via their constructors, if available. |
+ * |
+ * var e = new Event.type('MouseEvent', 'mousedown', true, true); |
+ */ |
+ factory Event.eventType(String type, String name, [bool canBubble = true, |
+ bool cancelable = true]) { |
+ final Event e = document.$dom_createEvent(type); |
+ e.$dom_initEvent(name, canBubble, cancelable); |
+ return e; |
+ } |
$!MEMBERS |
} |