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..5eb80eecfaf7e8dc7f5627ac55d689e0bb982f50 100644 |
| --- a/tools/dom/templates/html/impl/impl_Event.darttemplate |
| +++ b/tools/dom/templates/html/impl/impl_Event.darttemplate |
| @@ -34,6 +34,32 @@ $(ANNOTATIONS)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC { |
| return e; |
| } |
| - $CLASSNAME._private(); |
|
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
|
| + /** |
| + * Caches the pointer to the element that matches CSS selector involved in |
| + * the event. |
| + */ |
| + Element _cachedMatchingTarget; |
| + |
| + /** |
| + * 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() { |
| + if (_cachedMatchingTarget == null) { |
| + var currentTarget = this.currentTarget; |
| + var target = this.target; |
| + var matchedTarget; |
| + while (matchedTarget == null && target != currentTarget && |
| + target != null) { |
| + 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
|
| + matchedTarget = target; |
| + } |
| + target = target.parent; |
| + } |
| + _cachedMatchingTarget = matchedTarget; |
| + } |
| + return _cachedMatchingTarget; |
| + } |
| $!MEMBERS |
| } |