vuejs / vuejs/docs

/guide/components/events.md

Open
#2,300 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Vue
Stars
3.2k
Forks
5k
Avg merge
14d 17h
Merged PRs (30d)
1

Description

https://github.com/vuejs/docs/blob/1faadee96301601b7b0e9bd022bea2331a573d0b/src/guide/components/events.md?plain=1#L225

avoiding edge cases caused by DOM events manually dispatched by 3rd party code


https://github.com/vuejs/core/issues/27

The problem is that these same listeners can also be triggered by custom events - in the above example, both a native click event and a custom one emitted by this.$emit('click') in the child will trigger the parent's foo handler. This may lead to unwanted behavior.

I don't quite understand why edge cases are caused by 3rd party code manually dispatch event?
If declare the events in emits option, should the events only manually dispatched by code be the target's behavior?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read src/guide/components/events.md around line 225 and the linked vuejs/core issue 27 to understand the documented DOM and custom-event behavior. Done means resolving the question with a clear, technically accurate explanation or documentation update that distinguishes the third-party dispatch edge case.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
documentation
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.