On Thursday, May 31, 2012 at 8:49 PM, Mark S. Miller wrote: > > > On Thu, May 31, 2012 at 5:41 PM, Rick Waldron <[email protected] > (mailto:[email protected])> wrote: > > > > > > On Thu, May 31, 2012 at 8:11 PM, Mark S. Miller <[email protected] > > (mailto:[email protected])> wrote: > > > On Thu, May 31, 2012 at 4:55 PM, Rick Waldron <[email protected] > > > (mailto:[email protected])> wrote: > > > > Could you post a corrected example? Thanks. > > > > To reduce any confusion, I've posted the corrected code here: > > https://gist.github.com/2847608 > > Does the code you show (with comments deleted) > > DOM.each = function( elems, callbackFn ) { > var bound; > > if ( !Function.isBound(callbackFn) ) { > bound = callbackFn.bind( elems ); > } else { > bound = callbackFn; > } > > [].forEach.call( elems, bound ); > } > > > do anything different than the simpler code > > > DOM.each = function( elems, callbackFn ) { > var bound; > > bound = callbackFn.bind( elems ); > > [].forEach.call( elems, bound ); > } > >
The original API allowed me to pass an explicitly bound callback (whether it was by bind or fat arrow) and have that binding take precendence over a default behavior. I'll be honest, as I wrote this, it _did_ feel contrived. Rick > > ? > > -- > Cheers, > --MarkM
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

