diff --git a/lib/assets/javascripts/turbograft/turbohead.coffee b/lib/assets/javascripts/turbograft/turbohead.coffee index 814798ea..aa13dfa1 100644 --- a/lib/assets/javascripts/turbograft/turbohead.coffee +++ b/lib/assets/javascripts/turbograft/turbohead.coffee @@ -26,8 +26,7 @@ updateScriptTags = (activeDocument, newScripts, callback) -> ) extractTrackedAssets = (doc) -> - for node in doc.head.children when node.dataset.turbolinksTrack? - node + [].slice.call(doc.querySelectorAll('[data-turbolinks-track]')) filterForNodeType = (nodeType) -> (node) -> node.nodeName == nodeType diff --git a/test/javascripts/turbolinks_test.coffee b/test/javascripts/turbolinks_test.coffee index a8d1fdf7..8508ebcb 100644 --- a/test/javascripts/turbolinks_test.coffee +++ b/test/javascripts/turbolinks_test.coffee @@ -64,7 +64,7 @@ describe 'Turbolinks', -> visit = ({options, url}, callback) -> $(document).one('page:load', (event) -> - setTimeout((-> callback(event)), 0) + setTimeout((-> callback(event) if callback), 0) ) Turbolinks.visit('/' + url, options)