Event Delegation and Event Handlers: Web Development and other stuff
Rob Cherny.Com: JavaScript Event Delegation and Event Handlers: Web Development and other stuff: "JavaScript Event Delegation and Event Handlers"
http://icant.co.uk/sandbox/eventdelegation
Event delegation Element Extension Mootools based
Element.implement({
delegate: function(eventType,rules,prevent){
return this.addEvent(eventType, function(event) {
var target = $(event.target);
var prevent = prevent || true;
for (var selector in rules) {
if (target.match(selector)) {
if (prevent) { event.preventDefault(); }
return rules[selector].apply(this, $A(arguments));
}
}
});
}
});
No hay comentarios:
Publicar un comentario