Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- delegate: function(rules) {
- return function(e) {
- var target = $(e.target);
- // first check the target itself
- for(var selector in rules){
- if (target.is(selector))
- return rules[selector].apply(this, $.makeArray(arguments));
- }
- // then, jump up to parents
- for(var selector in rules){
- if ((target = target.parents(selector)) && target.length > 0)
- return rules[selector].apply(this, [target].concat($.makeArray(arguments)));
- }
- }
- }
Add Comment
Please, Sign In to add comment