在下面的代码中,当调用
$(this)
时,jQuery 是否重新查询 DOM,就好像传递了一个选择器(使用对象的某个属性作为选择器),还是保留之前返回的对象?$('.someButton').on('click', function() {
$(this).remove(); // Is this another lookup, or just a wrapper for the previously returned object?
});
$(this)
不会导致重新查找。http://jsperf.com/this-slowing-us-down - Deryck