Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(45)

Unified Diff: tools/dom/src/EventStreamProvider.dart

Issue 26722002: Add "matchingTarget" function to Event, which is the Element that matched the CSS value selector. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/html/element_test.dart ('k') | tools/dom/templates/html/impl/impl_Event.darttemplate » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/dom/src/EventStreamProvider.dart
diff --git a/tools/dom/src/EventStreamProvider.dart b/tools/dom/src/EventStreamProvider.dart
index 55bf8b90ae93e96a1a43d6fd1f35721ea6209177..5ab9ce406f6f7328a66de2ffd02e4867af73a4ff 100644
--- a/tools/dom/src/EventStreamProvider.dart
+++ b/tools/dom/src/EventStreamProvider.dart
@@ -51,8 +51,11 @@ class _ElementEventStreamImpl<T extends Event> extends _EventStream<T>
_ElementEventStreamImpl(target, eventType, useCapture) :
super(target, eventType, useCapture);
- Stream<T> matches(String selector) =>
- this.where((event) => event.target.matchesWithAncestors(selector));
+ Stream<T> matches(String selector) => this.where(
+ (event) => event.target.matchesWithAncestors(selector)).map((e) {
+ e._selector = selector;
+ return e;
+ });
}
/**
@@ -73,8 +76,11 @@ class _ElementListEventStreamImpl<T extends Event> extends Stream<T>
_stream = _pool.stream;
}
- Stream<T> matches(String selector) =>
- this.where((event) => event.target.matchesWithAncestors(selector));
+ Stream<T> matches(String selector) => this.where(
+ (event) => event.target.matchesWithAncestors(selector)).map((e) {
+ e._selector = selector;
+ return e;
+ });
// Delegate all regular Stream behavor to our wrapped Stream.
StreamSubscription<T> listen(void onData(T event),
« no previous file with comments | « tests/html/element_test.dart ('k') | tools/dom/templates/html/impl/impl_Event.darttemplate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698