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

javascript - Can Piwik report referrer in real time? -

asp.net - Google Drive Access: At least one client secrets (Installed or Web) should be set -

excel vba add hyperlink to shape in group -