diff --git a/test_app/app/assets/javascripts/application.js b/test_app/app/assets/javascripts/application.js index 5623d64..23c3ec1 100644 --- a/test_app/app/assets/javascripts/application.js +++ b/test_app/app/assets/javascripts/application.js @@ -53,7 +53,6 @@ NotFoos.prototype.otherAction = function(){}; $(document).ready(function(){ - Paloma.start(); $('#js-ajax-link').on('click', function(e){ diff --git a/vendor/assets/javascripts/paloma/paloma.js b/vendor/assets/javascripts/paloma/paloma.js index d65722d..8fed7e8 100644 --- a/vendor/assets/javascripts/paloma/paloma.js +++ b/vendor/assets/javascripts/paloma/paloma.js @@ -17,13 +17,15 @@ Paloma.engine = new Paloma.Engine({factory: Paloma._controllerFactory}); Paloma._executeHook = function(){ - var hook = document.getElementsByClassName('js-paloma-hook')[0]; - if (!hook) return; + var hooks = document.getElementsByClassName('js-paloma-hook'); + if (hooks.length == 0) return; - var script = hook.getElementsByTagName('script')[0]; - if (!script) return; + for (var i = 0, n = hooks.length; i < n; i++){ + var hook = hooks[i], + script = hook.getElementsByTagName('script')[0]; - eval(script.innerHTML); + if (script) eval(script.innerHTML); + } }; Paloma.start = function(){