| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 part of dart.html; | 5 part of dart.html; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * Helper class to implement custom events which wrap DOM events. | 8 * Helper class to implement custom events which wrap DOM events. |
| 9 */ | 9 */ |
| 10 class _WrappedEvent implements Event { | 10 class _WrappedEvent implements Event { |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 /** | 52 /** |
| 53 * A pointer to the element whose CSS selector matched within which an event | 53 * A pointer to the element whose CSS selector matched within which an event |
| 54 * was fired. If this Event was not associated with any Event delegation, | 54 * was fired. If this Event was not associated with any Event delegation, |
| 55 * accessing this value will throw an [UnsupportedError]. | 55 * accessing this value will throw an [UnsupportedError]. |
| 56 */ | 56 */ |
| 57 Element get matchingTarget { | 57 Element get matchingTarget { |
| 58 if (_selector == null) { | 58 if (_selector == null) { |
| 59 throw new UnsupportedError('Cannot call matchingTarget if this Event did' | 59 throw new UnsupportedError('Cannot call matchingTarget if this Event did' |
| 60 ' not arise as a result of event delegation.'); | 60 ' not arise as a result of event delegation.'); |
| 61 } | 61 } |
| 62 var currentTarget = this.currentTarget; | 62 Element currentTarget = this.currentTarget; |
| 63 var target = this.target; | 63 Element target = this.target; |
| 64 var matchedTarget; | 64 var matchedTarget; |
| 65 do { | 65 do { |
| 66 if (target.matches(_selector)) return target; | 66 if (target.matches(_selector)) return target; |
| 67 target = target.parent; | 67 target = target.parent; |
| 68 } while (target != null && target != currentTarget.parent); | 68 } while (target != null && target != currentTarget.parent); |
| 69 throw new StateError('No selector matched for populating matchedTarget.'); | 69 throw new StateError('No selector matched for populating matchedTarget.'); |
| 70 } | 70 } |
| 71 | 71 |
| 72 /** | 72 /** |
| 73 * This event's path, taking into account shadow DOM. | 73 * This event's path, taking into account shadow DOM. |
| 74 * | 74 * |
| 75 * ## Other resources | 75 * ## Other resources |
| 76 * | 76 * |
| 77 * * [Shadow DOM extensions to | 77 * * [Shadow DOM extensions to |
| 78 * Event](http://w3c.github.io/webcomponents/spec/shadow/#extensions-to-even
t) | 78 * Event](http://w3c.github.io/webcomponents/spec/shadow/#extensions-to-even
t) |
| 79 * from W3C. | 79 * from W3C. |
| 80 */ | 80 */ |
| 81 // https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html#ex
tensions-to-event | 81 // https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html#ex
tensions-to-event |
| 82 @Experimental() | 82 @Experimental() |
| 83 List<Node> get path => wrapped.path; | 83 List<Node> get path => wrapped.path; |
| 84 | 84 |
| 85 dynamic get _get_currentTarget => wrapped._get_currentTarget; | 85 dynamic get _get_currentTarget => wrapped._get_currentTarget; |
| 86 | 86 |
| 87 dynamic get _get_target => wrapped._get_target; | 87 dynamic get _get_target => wrapped._get_target; |
| 88 } | 88 } |
| OLD | NEW |