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..b982e0143509e3351d6b3ca471c99145773a1c4e 100644 |
--- a/tools/dom/templates/html/impl/impl_Event.darttemplate |
+++ b/tools/dom/templates/html/impl/impl_Event.darttemplate |
@@ -16,4 +16,16 @@ $(ANNOTATIONS)class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC { |
factory $CLASSNAME(String type, [bool canBubble = true, bool cancelable = true]) => |
_$(CLASSNAME)FactoryProvider.create$CLASSNAME(type, canBubble, cancelable); |
$!MEMBERS |
+ |
+ /** |
+ * Checks to see if the event class is supported by the current platform. |
+ */ |
+ static bool _isTypeSupported(String eventType) { |
+ // Browsers throw for unsupported event names. |
+ try { |
+ var e = document.$dom_createEvent(eventType); |
+ return e is Event; |
+ } catch (_) { } |
+ return false; |
+ } |
} |