From bfc5566b24faade0486ddddca61ace68303a7c35 Mon Sep 17 00:00:00 2001 From: Philip Date: Sat, 11 Dec 2021 16:05:08 +0100 Subject: [PATCH] Update events.md Added a note on `event.target` vs `event.currentTarget` with respect to referencing the clicked element or potential child elements. Although this is somewhat outside of the Vue code base, it might be confusing from the given example. See [this documentation](https://developer.mozilla.org/en-US/docs/Web/API/Event/currentTarget) for reference. --- src/v2/guide/events.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/v2/guide/events.md b/src/v2/guide/events.md index ede0254df2..bd57c0d636 100644 --- a/src/v2/guide/events.md +++ b/src/v2/guide/events.md @@ -104,6 +104,8 @@ var example2 = new Vue({ {% endraw %} +

Note that `event.target` might reference a child element of the element on which the `v-on` was set. Use `event.currentTarget` to get the element of the `v-on`.

+ ## Methods in Inline Handlers Instead of binding directly to a method name, we can also use methods in an inline JavaScript statement: