$('#id tag') vs. $('#id').find('tag') - which is preferable?

前端 未结 6 885
情深已故
情深已故 2020-12-10 11:54

I want to know which option is better, particularly in terms of their speed:

$(\'#id tag\')...

or

$(\'#id\').find(\'tag\')         


        
6条回答
  •  自闭症患者
    2020-12-10 11:55

    Performance measure here: :)==> http://jsperf.com/find-vs-descendant-selector

    Seems like descendant way is lil faster but perform poorly in opera,

    anyhoo in my opinion it doesn't matter :)

    Hope this answers your question and see here Is .find() faster than basic descendant selecting method?

提交回复
热议问题