danielfarrell / bootstrap-combobox

A combobox plugin that works with twitter bootstrap
849 stars 328 forks source link

Fix bug when using with Turbolinks #264

Closed gSanchezCiarrocchi closed 5 years ago

gSanchezCiarrocchi commented 5 years ago

When using Turbolinks and navigating back or forward in the browser history the plugin is generating extra comboboxes, I think this is because Turbolinks caches the page and then when navigating through the browser history the plugins creates extra comboboxes from the previous generated comboboxes.

For example, this happens when navigating back in history (there should be only one dropdown):

duplicated-combobox

With this change we ensure to remove from the DOM previous generated comboboxes at the moment the plugin tries to create new comboboxes based on them.

gSanchezCiarrocchi commented 5 years ago

I'm closing this PR as there is no actual need for it. Turbolinks provides a way to handle this kind of problems caused by "extra" elements in the DOM when using the pages from the Turbolinks cache.