$(e.currentTarget)和$(this)之间有区别吗?

问题描述:

以下两种方法有什么区别吗?比#2快#1?

is there any difference between the following two methods? is #1 faster than #2 ?

#1
$('#selector').on('click',function(){
  $(this)...
  // do stuff with clicked element
})

and

#2
$('#selector').on('click',function(e){
  $(e.currentTarget)....
  // do stuff with clicked element
})


好像它们是在大多数情况下相同,但根据

Seems like they are equivalent in most cases, though "this" seems easier to type

rel =noreferrer> http://api.jquery.com/event.currentTarget/

according to http://api.jquery.com/event.currentTarget/


event.currentTarget

此属性通常等于的函数。

This property will typically be equal to the this of the function.

如果您使用的是 jQuery。代理或其他形式的范围操纵,
将等于w你提供的hatever上下文,而不是
event.currentTarget

If you are using jQuery.proxy or another form of scope manipulation, this will be equal to whatever context you have provided, not event.currentTarget