by goto11 · 6y ago · 0 comments
The use of method chaining in jQuery is cool, but it is not very similar to Haskell.
That's what the jQuery API does behind the scene of the chained calls. That's one of the key reasons of its success actually.
$(".foo").foo().bar() will execute n times, for each of the n DOM elements you matched with ".foo", including one or zero.
Yes this is a cool and useful pattern, but it is not bind. It is just a different thing.