Closed kristianpd closed 9 years ago
/cc @Thibaut
Unlike Turbograft, Turbolinks 3 re-runs all scripts on the page on partial replacement. But I think it makes sense to only run those nested in the elements that have been swapped in, instead of all of them, now that we have data-turbolinks-eval=always
(which we would also re-run).
I'll PR the change soon.
:+1: i'm fine for forcing people to be explicit with data-turbolinks-eval=always
to help prevent weird inline JS problems. thanks @Thibaut
It seems to currently run scripts in partials twice. If I have a script tag in a partial, and I say "Turbolinks.visit(url, { change: 'mypartial' }), scripts in 'mypartial' are evaluated twice. This only happens if I specify a 'change' option on visit.
Fixed by #618.
We ran in to this recently on another project, TG change is here: https://github.com/Shopify/turbograft/pull/92
I haven't had a chance to test this on base TL but I want to make sure this is tracked in case we aren't.