jQuery $('#submitForm').find('form') vs jQuery $('#submitForm form') -


i wondering of both methods faster:

selecting container , form @ in 1 statement:

jquery $('#submitform form') 

or using jquery's .find() selector:

jquery $('#submitform').find('form') 

the .find() approach faster because first selection handled without going through sizzle selector engine – id-only selections handled using document.getelementbyid(), extremely fast because native browser.

so

jquery $('#submitform').find('form') 

is faster than

jquery $('#submitform form') 

selector optimization less important used be, more browsers implement document.queryselectorall() , burden of selection shifts jquery browser.


Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

c# - two queries in same method -