@Tobie: "[*Evil Cackle*]... You just now noticed that, did you?"
Yeah, it's a nice little trick. And, yes, it does look a little fishy, but I couldn't think of any reason why it wouldn't work. I've updated the blog post to include your implementation in the tests. (BTW, please note that if you'd like to experiment with the tests, you need only save the HTML source of the test page to a file on your local disk and it should work just fine. You can hack on the tests from there.) I certainly understand the desire to have readable, maintainable code. My opinion in this particular case is that bind() is such a universal operation, and the behavior so well defined, and the implementation so compact, that sacrificing a little readability for the sake of optimizing performance may be justified. That said, you're variation above addresses 98.5% of the important use cases. :-) I would like to see the _boundFunction reference included in whatever solution you settle on. While not essential, I believe it will allow developers to provide useful debugging capabilities if so desired, even if you decide not to include the unbind() method I suggested. I'm perfectly happy to add my own extensions for stuff like that, but having to override base implementations, as we're currently doing, has always felt a little hackish. So having that reference built into the native bind() implementation would be nice. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~----------~----~----~----~------~----~------~--~---
