turbolinks / turbolinks-classic

Classic version of Turbolinks. Now deprecated in favor of Turbolinks 5.
MIT License
3.54k stars 428 forks source link

temporary inside permanent #674

Open neohunter opened 7 years ago

neohunter commented 7 years ago

Using turbolinks 3, current master.

I've this

<nav id="m" data-turbolinks-permanent>
   ...
   <span id="notifications_counter" data-turbolinks-temporary>3</span>
</nav>

But it does not seems to work, the span content keeps the same. I've tried to write a workaround for this using the differents events of pageload, for example:

addEventListener("page:change", function(newBody) {
   counter = $(newBody.data).find('#notification_counter').text();
...

But the counter is always the original loaded value, I guess because is inside on permanent, Is there a way to access the real html code that was loaded previous to the permanent modifications? Or this should work?