Fix loading issues when using synthetic DOM ready events

This change fixes compatibility with Wiselinks, and probably also with Pjax and Turbolinks.