The whole fun starts, when the user visits a previously cached page. In that case, Turbolinks will emit turbolinks:before-render immediately after caching up the previous page. Then it will replace the body and header tags with the cached version of the page which is being loaded from the server. This operation is concluded with single turbolinks:render event, without firing the load event. When the AJAX call is finished, another turbolinks:before-render event is emmited (for the cached version), and the flow continues as in the uncached version. The load event is called only after rendering the server version of the page.
This pattern has been referred to as a self-executing anonymous function, but @cowboy (Ben Alman) introduced the term IIFE as a more semantically accurate term for the pattern .