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

Side by Side Diff: tools/dom/templates/html/impl/impl_Event.darttemplate

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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tests/html/element_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // WARNING: Do not edit - generated code. 5 // WARNING: Do not edit - generated code.
6 6
7 part of $LIBRARYNAME; 7 part of $LIBRARYNAME;
8 8
9 $(ANNOTATIONS)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC { 9 $(ANNOTATIONS)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC {
10 // In JS, canBubble and cancelable are technically required parameters to 10 // In JS, canBubble and cancelable are technically required parameters to
(...skipping 16 matching lines...) Expand all
27 * 27 *
28 * var e = new Event.type('MouseEvent', 'mousedown', true, true); 28 * var e = new Event.type('MouseEvent', 'mousedown', true, true);
29 */ 29 */
30 factory Event.eventType(String type, String name, {bool canBubble: true, 30 factory Event.eventType(String type, String name, {bool canBubble: true,
31 bool cancelable: true}) { 31 bool cancelable: true}) {
32 final Event e = document._createEvent(type); 32 final Event e = document._createEvent(type);
33 e._initEvent(name, canBubble, cancelable); 33 e._initEvent(name, canBubble, cancelable);
34 return e; 34 return e;
35 } 35 }
36 36
37 $CLASSNAME._private(); 37 /**
blois 2013/10/09 20:47:18 Why remove of this?
Emily Fortuna 2013/10/09 22:16:28 It got accidentally added in https://codereview.ch
38 * Caches the pointer to the element that matches CSS selector involved in
39 * the event.
40 */
41 Element _cachedMatchingTarget;
42
43 /**
44 * A pointer to the element whose CSS selector matched within which an event
45 * was fired. If this Event was not associated with any Event delegation,
46 * then this value will be null.
47 */
48 Element matchingTarget() {
49 if (_cachedMatchingTarget == null) {
50 var currentTarget = this.currentTarget;
51 var target = this.target;
52 var matchedTarget;
53 while (matchedTarget == null && target != currentTarget &&
54 target != null) {
55 if (target.matches('.selector')) {
blois 2013/10/09 20:47:18 hardcoded??
Emily Fortuna 2013/10/09 22:16:28 That's what I get for copying my comment from the
56 matchedTarget = target;
57 }
58 target = target.parent;
59 }
60 _cachedMatchingTarget = matchedTarget;
61 }
62 return _cachedMatchingTarget;
63 }
38 $!MEMBERS 64 $!MEMBERS
39 } 65 }
OLDNEW
« no previous file with comments | « tests/html/element_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698