Jquery find()选择器顺序和性能

时间:2017-07-19 22:14:00

标签: javascript jquery performance

对于jQuery find(),选择器的顺序在性能上是否重要?

即。以下两个代码片段是否同时运行,选择器的顺序是唯一的区别?

$('#commentList').find('.x-comment-no-edit.new-comment').each(function(){
    //Option 1
});

$('#commentList').find('.new-comment.x-comment-no-edit').each(function(){
    //Option 2
});


<div id="commentList">
    <div class="x-comment-no-edit"></div>
    <div class="x-comment-no-edit"></div>
    <div class="x-comment-no-edit new-comment"></div>
</div>

0 个答案:

没有答案