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

Fix "destory" method in view plugins. #1882

Merged
merged 1 commit into from
Sep 22, 2021
Merged

Conversation

KaneCohen
Copy link
Contributor

Update destory methods on BubbleMenu and FloatingMenu plugins to correctly remove event listeners.

@philippkuehn
Copy link
Contributor

what do you mean by correctly remove event listeners? is there any issue that you can explain? thanks!

@KaneCohen
Copy link
Contributor Author

KaneCohen commented Sep 22, 2021

Mousedown event is added with a "capture" flag:

 this.element.addEventListener('mousedown', this.mousedownHandler, { capture: true })

In order to remove event listener same "signature" of the event should be used, including capture flag. Currently this is not the case:

this.element.removeEventListener('mousedown', this.mousedownHandler)

Which leads to mousedown event not being removed.

multiple events

From MDN Web Docs:

The EventTarget.removeEventListener() method removes from the EventTarget an event listener previously registered with EventTarget.addEventListener(). The event listener to be removed is identified using a combination of the event type, the event listener function itself, and various optional options that may affect the matching process; see Matching event listeners for removal

@philippkuehn
Copy link
Contributor

ah great! thanks!

@philippkuehn philippkuehn merged commit 33420f4 into ueberdosis:main Sep 22, 2021
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