Today, I try to answer to the question here. So, the person how asked question uses jQuery 1.6 for some reason (I have never used this version by myself before). However i knew about .live() event attachment with data option from documentation, which was deprecated in 1.7. So, when i used $(this)
inside of event handling function it returns selector object not data object.
So I created two test file here, one in jQuery 1.6.4 and other in 1.10.1 as following.
Jquery 1.6.4
$('body').live('click', 'span.some_class', function(e){
console.log($(this))
});
Jquery 1.10.1
$('body').on('click', 'span.some_class', function(e){
console.log($(this));
});
In first case i got following output:
[body, context: body, constructor: ....
In second case i got following output:
[span.some_class, context: ......
So, I have question, Why output is different? Can someone give me explanation who have historical knowledge on this?. Because it can be really useful to my to help to others when they ask me question related to jQuery 1.6.4.
Edit: So i understand what I did wrong here is I messed .live() with .on() which is not equivalent in newer version of jQuery. So .on() is equivalent to .delegate() in 1.6.4 and live() equivalent to bind(). Sorry for my question. I did not read documentation carefully.