Why do defer javascript execution?
First of all there is a problem of performance, second most time you want to control exactly when a function is executed.
This could be done without defer attribute using data structure specified in json notation:
{type:'right',sel:"a",weight:0}
Then execute at page load all javascript in the order you choose, also calling (using jQuery for example):
var m;
$("."+class).each(function(i,el){
eval('m.push('+$(el).html()+');');
});
// one can ...