Chromium Code Reviews| Index: tools/dom/templates/html/impl/impl_Event.darttemplate |
| diff --git a/tools/dom/templates/html/impl/impl_Event.darttemplate b/tools/dom/templates/html/impl/impl_Event.darttemplate |
| index a3fc47f660dd5faa429cd19a30bde06f4fc51673..54ebb3e5138b8810364d7d9f39aeb86ab85225fa 100644 |
| --- a/tools/dom/templates/html/impl/impl_Event.darttemplate |
| +++ b/tools/dom/templates/html/impl/impl_Event.darttemplate |
| @@ -34,6 +34,35 @@ $(ANNOTATIONS)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC { |
| return e; |
| } |
| - $CLASSNAME._private(); |
| + /** |
| + * Caches the pointer to the element that matches CSS selector involved in |
| + * the event. |
| + */ |
| + 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
|
| + |
| + /** The CSS selector involved with event delegation. */ |
| + String _selector; |
| + |
| + /** |
| + * 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, |
| + * then this value will be null. |
| + */ |
| + 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
|
| + if (_cachedMatchingTarget == null) { |
| + var currentTarget = this.currentTarget; |
| + var target = this.target; |
| + var matchedTarget; |
| + while (matchedTarget == null && target != currentTarget && |
| + target != null) { |
| + 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.
|
| + matchedTarget = target; |
| + } |
| + target = target.parent; |
| + } |
| + _cachedMatchingTarget = matchedTarget; |
| + } |
| + return _cachedMatchingTarget; |
| + } |
| $!MEMBERS |
| } |