1
0
Fork 0
mirror of https://github.com/kbparagua/paloma synced 2023-03-27 23:21:17 -04:00

Make sure to execute all available hooks on the document

This commit is contained in:
kbparagua 2016-03-02 13:38:49 +08:00
parent 92c6695d99
commit a892d26f08
2 changed files with 7 additions and 6 deletions

View file

@ -53,7 +53,6 @@ NotFoos.prototype.otherAction = function(){};
$(document).ready(function(){
Paloma.start();
$('#js-ajax-link').on('click', function(e){

View file

@ -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(){