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

Leaking Event Handler #287

Closed
jlukic opened this issue Sep 9, 2016 · 2 comments
Closed

Leaking Event Handler #287

jlukic opened this issue Sep 9, 2016 · 2 comments
Labels
DEPRECATED jquery-textcomplete Issues associated to jquery-textcomplete (was DEPRECATED) enhancement

Comments

@jlukic
Copy link

jlukic commented Sep 9, 2016

There's currently a bubbled event being watched on document that appears to be bound to document regardless of whether a textcomplete component is initialized.

Attaching an event handler on every bubbled click event is fairly expensive. This most likely should be part of the components initialize and destroy method, so that it doesn't continue to evaluate on every click event in your site/app.

To make sure its attached once across components you'll most likely need to use some novel strategy, but it could be accomplished using something like unique ids, or namespaced events.

@yuku
Copy link
Owner

yuku commented Sep 9, 2016

Hi @jlukic, thanks for opening the issue.

I agree that global click event handler costs a bit but I'm not sure it is worth optimized. Does it cause performance issues in your app?

@jlukic
Copy link
Author

jlukic commented Sep 9, 2016

I'm working on a single page app with something like 50+ distinct pages. Only a few of them use the textcomplete component, however all click events on all pages fire the textcomplete document event handler.

There's no specific issue with the event handler performing poorly, however the design might cause memory issues. The event handler carries a reference to dropdownViews which prevents it from being garbage collected by the browser.

@yuku yuku closed this as completed Jun 15, 2020
@yuku yuku added the DEPRECATED jquery-textcomplete Issues associated to jquery-textcomplete (was DEPRECATED) label Jun 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DEPRECATED jquery-textcomplete Issues associated to jquery-textcomplete (was DEPRECATED) enhancement
Projects
None yet
Development

No branches or pull requests

2 participants