JavaScript JavaScript and the DOM Getting a Handle on the DOM Using CSS Queries to Select Page Elements


Does querySelector use up more resources or take longer than using the other selectors getElementById, or getElementsByClassName?

I think they are more or less equally performant if you compare the right things. When you use querySelector and you do a query on a class than you should compare with getElementByClassName, if you do a query on an id, you should compare with getElementById.