Skip to content
Browse files

Copy script tag list by slicing

  • Loading branch information...
1 parent 6126ccc commit 6cd6e33734c5ddec236eca915447f48d8670ef77 @reed reed committed
Showing with 2 additions and 1 deletion.
  1. +2 −1 lib/assets/javascripts/turbolinks.js.coffee
View
3 lib/assets/javascripts/turbolinks.js.coffee
@@ -85,7 +85,8 @@ changePage = (title, body, runScripts) ->
triggerEvent 'page:change'
executeScriptTags = ->
- for script in document.body.getElementsByTagName 'script' when script.type in ['', 'text/javascript']
+ scripts = Array::slice.call document.body.getElementsByTagName 'script'
+ for script in scripts when script.type in ['', 'text/javascript']
copy = document.createElement 'script'
copy.setAttribute attr.name, attr.value for attr in script.attributes
copy.appendChild document.createTextNode script.innerHTML

0 comments on commit 6cd6e33

Please sign in to comment.
Something went wrong with that request. Please try again.