Skip to content
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

some questions #19

Open
fingerpan opened this issue Sep 23, 2017 · 1 comment
Open

some questions #19

fingerpan opened this issue Sep 23, 2017 · 1 comment
Labels

Comments

@fingerpan
Copy link

fingerpan commented Sep 23, 2017

i read your code and i have some questions.
1: if the ouside element make a event stopPropagation, your code maybe can not work
2: addEventListener too much

@simplesmiler
Copy link
Owner

Hi, thanks for taking your time to read the code!

You are correct regarding the stopPropagation, and this is exactly why it's recommended not to use stopPropagation unless you know exactly what you are doing.

Regarding event listeners, alternative to this is to use a custom event emitter, and to have a single event listener on the document root that would notify all custom listeners. But I'm not sure this would significantly improve performance.

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

No branches or pull requests

2 participants