DEV Community

Discussion on: Use $ & $$ Instead of document.querySelector/All in JavaScript without jQuery

Collapse
 
capsule profile image
Thibaut Allender

From a performance perspective, that would double the amount of work for every selector. Going from jQuery to Vanilla JS is mostly about being more performant, so that looks like an anti-pattern.

Collapse
 
ahmadawais profile image
Ahmad Awais ⚡️

Can you explain how would that be the double amount of work? It's just one extra call.

Thread Thread
 
capsule profile image
Thibaut Allender

It's 2 calls instead of one, so it's double.