Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 /** |
| 38 * Caches the pointer to the element that matches CSS selector involved in | |
| 39 * the event. | |
| 40 */ | |
| 41 Element _cachedMatchingTarget; | |
|
blois
2013/10/09 22:25:44
Probably does not need to be cached- in most cases
Emily Fortuna
2013/10/09 22:39:18
Removed
| |
| 42 | |
| 43 /** The CSS selector involved with event delegation. */ | |
| 44 String _selector; | |
| 45 | |
| 46 /** | |
| 47 * A pointer to the element whose CSS selector matched within which an event | |
| 48 * was fired. If this Event was not associated with any Event delegation, | |
| 49 * then this value will be null. | |
| 50 */ | |
| 51 Element matchingTarget() { | |
|
blois
2013/10/09 22:25:44
Can this be a getter?
Emily Fortuna
2013/10/09 22:39:18
Yeah, but it felt like a function was a little mor
blois
2013/10/09 23:12:57
Yes plz! It just feels odd as a method when it's b
| |
| 52 if (_cachedMatchingTarget == null) { | |
| 53 var currentTarget = this.currentTarget; | |
| 54 var target = this.target; | |
| 55 var matchedTarget; | |
| 56 while (matchedTarget == null && target != currentTarget && | |
| 57 target != null) { | |
| 58 if (_selector != null && target.matches(_selector)) { | |
|
blois
2013/10/09 22:25:44
Can there be an earlier out if _selector is null?
Emily Fortuna
2013/10/09 22:39:18
added earlier out.
| |
| 59 matchedTarget = target; | |
| 60 } | |
| 61 target = target.parent; | |
| 62 } | |
| 63 _cachedMatchingTarget = matchedTarget; | |
| 64 } | |
| 65 return _cachedMatchingTarget; | |
| 66 } | |
| 38 $!MEMBERS | 67 $!MEMBERS |
| 39 } | 68 } |
| OLD | NEW |