【发布时间】:2011-10-31 01:06:20
【问题描述】:
做起来有什么不同:
$(this).find('.action')
或
$('.action', this)
性能?如果是的话,哪个更好,为什么?
还有什么?
【问题讨论】:
标签: jquery performance jquery-selectors
做起来有什么不同:
$(this).find('.action')
或
$('.action', this)
性能?如果是的话,哪个更好,为什么?
还有什么?
【问题讨论】:
标签: jquery performance jquery-selectors
这与每个 jQuery 文档 (http://api.jquery.com/jQuery/) 没有区别:
在内部,选择器上下文是用 .find() 方法实现的,所以 $('span', this) 等价于 $(this).find('span')。
【讨论】:
.find() 防止额外调用不是更好吗?