Skip to content
This repository has been archived by the owner on Jun 26, 2019. It is now read-only.

Destroy() does not properly remove bindings #6

Open
amelhorn opened this issue Feb 13, 2018 · 0 comments
Open

Destroy() does not properly remove bindings #6

amelhorn opened this issue Feb 13, 2018 · 0 comments

Comments

@amelhorn
Copy link

amelhorn commented Feb 13, 2018

Found out with testing that .destory() does not properly remove binding. Example Code:
`window.autocomplete = new TeleportAutocomplete({
el: '#search-box',
maxItems: 5,
geoLocate: false
});

$('#search-by-keyword span').on('click', function() {
window.autocomplete.destroy();
}`
After clicking the span identified, you can type into the box, but on pressing 'enter' the keydown bind for TeleportAutocomplete will fire. This can be corrected by commenting out lines 58-59:

// Shorthands
//HTMLElement.prototype.on = HTMLElement.prototype.addEventListener;
//HTMLElement.prototype.off = HTMLElement.prototype.removeEventListener;

and converting all .on/.off calls to jQuery.on/.off.

This may only be a problem when autocomplete is used in combination with jQuery. I have not tested this without.

@amelhorn amelhorn changed the title Destroy() does nto properly remove bindings Destroy() does not properly remove bindings Feb 13, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant