Open tobiashm opened 11 years ago
Thank you savior ! I'm using rails and with turbolinks this was causing a lot of problems.
Why would you run $('details').details() twice, though? What situation other than improper script inclusion would cause such a situation?
Oh, wait, this PR is also from 2013.
Turbolinks is a framework that load the next pages in AJAX and replaces the DOM contents accordingly. Because of that, the DOM javascript isn't reloaded completely, and I need to run this function again to make sure the <details>
of the next page are tweaked correctly. $(document).ready doesn't work and must be substituted by $(document).on('ready turbolinks:load')
.
Fair enough.
Basically any situation where new content might be injected into the page, which could include <details>
tags, especially if you don't have full control over exactly which part of the page is updated, and with what.
Yeah, loading of page subsections, makes sense.
On May 10, 2016, at 8:14 AM, Tobias H. Michaelsen notifications@github.com wrote:
Basically any situation where new content might be injected into the page, which could include
tags, especially if you don't have full control over exactly which part of the page is updated, and with what.— You are receiving this because you commented. Reply to this email directly or view it on GitHub
If you run something like
$('details').details();
twice on a page, it will bind the click handler twice, causing the details element to both open and close when clicked, thus returning to its pre-click state. I.e. it looks like the nothing has happened. Added namespace to click event to avoid collision with other event handlers.