Start your All-Access Pass to unlock this challenge
What happens when Turbo creates a preview of a page?
At the moment right before leaving the page, Turbo clones the DOM using cloneNode, which does not include event listeners added from JavaScript.
cloneNode
At page load, Turbo clones the DOM using a "deep clone" algorithm, but since JavaScript hasn't executed yet, no listeners are included in the preview.
At the moment right before leaving the page, Turbo clones the DOM using a "deep clone" algorithm, but removes any event listeners added by JavaScript because it relies on Stimulus to add them back.
At page load, and after all JavaScript has been parsed and executed, Turbo clones the DOM using a "deep clone" algorithm. It then removes any event listeners added by JavaScript because it relies on Stimulus to add them back.