ded / bonzo

library agnostic, extensible DOM utility
Other
1.32k stars 137 forks source link

Call setters with the element as scope. #127

Closed ryanve closed 11 years ago

ryanve commented 11 years ago

Conceptually I prefer how bonzo puts the el as argument 0 rather than the index like jQuery does. Duplicating the el as the scope facilitates writing code for the most common usage (using the element, not the index) that is compatible with both libs.

This allows:

.addClass(function(el) {
     el = this;
})

rather than:

.addClass(function(el) {
     el = typeof el == 'number' ? this : el;
})
ded commented 11 years ago

yeah i'm down for this

rvagg commented 11 years ago

+1, I hate the way jQuery overloads this so much but this makes sense for compatibility's sake.

ryanve commented 11 years ago

@ded Great, thanks. @rvagg Exactly.