Skip to content

#3372 Added a self event modifier #3377

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 11, 2019
Merged

#3372 Added a self event modifier #3377

merged 3 commits into from
Aug 11, 2019

Conversation

samuelgozi
Copy link
Contributor

Added support for a self modifier.
The self modifier only triggers the handler if event.target is the element itself.

Added and updated the tests, and documentation.
I don't know if the ESlint plugin derives the allowed modifiers from this project so I haven't done anything in that regard, but I'll gladly take care of that if needed.

Before submitting the PR, please make sure you do the following

  • It's really useful if your PR relates to an outstanding issue, so please reference it in your PR, or create an explanatory one for discussion. In many cases features are absent for a reason.
  • This message body should clearly illustrate what problems it solves. If there are related issues, remember to reference them.
  • Ideally, include a test that fails without this PR but passes with it. PRs will only be merged once they pass CI. (Remember to npm run lint!)

Tests

  • Run the tests tests with npm test or yarn test)

@Rich-Harris Rich-Harris merged commit 61ad408 into sveltejs:master Aug 11, 2019
@Rich-Harris
Copy link
Member

Thanks! This seems like a good addition (and thanks for including tests and docs — a perfect PR 🤗). I made one small tweak — since this (aka event.currentTarget) is always the element that the handler was attached to, there's no need to pass el around: d9206fb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants