So I was looking at the jQuery source and I found this:
delegate: function( selector, types, data, fn ) {
return this.live( types, data, fn, selector );
},
So .delegate() function is pretty much just the .live() function. The only difference is the order of the arguments! Why would the jQuery people do such a thing?
People generally omit the
selectorparameter onlive, I’d bet most people don’t even know the selector parameter is there.delegate()gives you easy access to theselectorparameter, which allows you to ‘scope’ your event listener to just a subset of the whole dom, which can result in better performance.It’s awkward to provide additional parameters after passing an inline anonymous function. Since the selector parameter is so useful, it makes sense for jquery to create a more convenient form.
See:
http://www.alfajango.com/blog/the-difference-between-jquerys-bind-live-and-delegate/