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

symfony - InvalidConfigurationException in SecurityExtension.php line 429: No authentication listener registered for firewall "secured_area" -

angular ui router - 10 digest iterations reached in angularjs when using $state.go -

javascript - Handling constructor related functions while testing with mocha and sinon -