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 43fc26219288f792ede669838c148b2573fced00..6786929d9be27014c9247a66e452b214d70ebe3a 100644 |
--- a/sdk/lib/html/dart2js/html_dart2js.dart |
+++ b/sdk/lib/html/dart2js/html_dart2js.dart |
@@ -29137,6 +29137,15 @@ class _BeforeUnloadEventStreamProvider implements |
String getEventType(EventTarget target) { |
return _eventType; |
} |
+ |
+ ElementStream<BeforeUnloadEvent> forElement(Element e, {bool useCapture: false}) { |
+ return new _ElementEventStreamImpl(e, _eventType, useCapture); |
+ } |
+ |
+ ElementStream<BeforeUnloadEvent> _forElementList(ElementList e, |
+ {bool useCapture: false}) { |
+ return new _ElementListEventStreamImpl(e, _eventType, useCapture); |
+ } |
} |
// 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 |
@@ -31550,7 +31559,7 @@ abstract class CanvasImageSource {} |
* * [DOM Window](https://developer.mozilla.org/en-US/docs/DOM/window) from MDN. |
* * [Window](http://www.w3.org/TR/Window/) from the W3C. |
*/ |
-abstract class WindowBase implements EventTarget { |
+abstract class WindowBase { |
// Fields. |
/** |
@@ -34857,6 +34866,10 @@ abstract class ReadyState { |
*/ |
class _WrappedEvent implements Event { |
final Event wrapped; |
+ |
+ /** The CSS selector involved with event delegation. */ |
+ String _selector; |
+ |
_WrappedEvent(this.wrapped); |
bool get bubbles => wrapped.bubbles; |
@@ -34894,6 +34907,39 @@ class _WrappedEvent implements Event { |
void stopPropagation() { |
wrapped.stopPropagation(); |
} |
+ |
+ /** |
+ * A pointer to the element whose CSS selector matched within which an event |
+ * was fired. If this Event was not associated with any Event delegation, |
+ * accessing this value will throw an [UnsupportedError]. |
+ */ |
+ Element get matchingTarget { |
+ if (_selector == null) { |
+ throw new UnsupportedError('Cannot call matchingTarget if this Event did' |
+ ' not arise as a result of event delegation.'); |
+ } |
+ var currentTarget = this.currentTarget; |
+ var target = this.target; |
+ var matchedTarget; |
+ do { |
+ if (target.matches(_selector)) return target; |
+ target = target.parent; |
+ } while (target != null && target != currentTarget.parent); |
+ throw new StateError('No selector matched for populating matchedTarget.'); |
+ } |
+ |
+ /** |
+ * This event's path, taking into account shadow DOM. |
+ * |
+ * ## Other resources |
+ * |
+ * * [Shadow DOM extensions to Event] |
+ * (http://w3c.github.io/webcomponents/spec/shadow/#extensions-to-event) from |
+ * W3C. |
+ */ |
+ // https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html#extensions-to-event |
+ @Experimental() |
+ List<Node> get path => wrapped.path; |
} |
// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
// for details. All rights reserved. Use of this source code is governed by a |