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

mysql - FireDac error 314 - but DLLs are in program directory -

git - How to list all releases of public repository with GitHub API V3 -

c++ - Getting C2512 "no default constructor" for `ClassA` error on the first parentheses of constructor for `ClassB`? -