I'm using jQuery in my web application. I've been using .bind() but I see that it is a little slow, so while reading the documentation I read about .on() and .delegate(). I understand how .delegate() works but I’m not clear on what is the difference between it and .on() or which is better in which scenarios.
Also I'm using jQuery 1.6 so I would like to know if it is worth it to prepare my script for jQuery 1.7 by putting in a condition similar to the following:
if(typeof $(selector).on == 'function'){
/* use .on() */
}else{
/* use .delegate() */
}
Is this a good idea (to prepare for .on()) or is it just looking for trouble for nothing?
Please help me to get clear understanding of these methods.