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 6276aa70662e848dcf08f2e26ffed8a334f8b82f..bae41db443dca3963761172b3b30db0834e7b873 100644 |
--- a/sdk/lib/html/dart2js/html_dart2js.dart |
+++ b/sdk/lib/html/dart2js/html_dart2js.dart |
@@ -10199,6 +10199,18 @@ class Event native "*Event" { |
@DomName('Event.stopPropagation') |
void stopPropagation() native; |
+ |
+ /** |
+ * 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; |
+ } |
} |
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
// for details. All rights reserved. Use of this source code is governed by a |
@@ -15826,6 +15838,9 @@ class MediaStreamEvents extends Events { |
@DomName('MediaStreamEvent') |
class MediaStreamEvent extends Event native "*MediaStreamEvent" { |
+ /// Checks if this type is supported on the current platform. |
+ static bool get supported => Event._isTypeSupported('MediaStreamEvent'); |
+ |
@DocsEditable |
@DomName('MediaStreamEvent.stream') |
final MediaStream stream; |
@@ -15935,6 +15950,9 @@ class MediaStreamTrackEvents extends Events { |
@DomName('MediaStreamTrackEvent') |
class MediaStreamTrackEvent extends Event native "*MediaStreamTrackEvent" { |
+ /// Checks if this type is supported on the current platform. |
+ static bool get supported => Event._isTypeSupported('MediaStreamTrackEvent'); |
+ |
@DocsEditable |
@DomName('MediaStreamTrackEvent.track') |
final MediaStreamTrack track; |