Alex HerreraPro Student 6,392 Points
Why would you not ALWAYS use this selector?
It seems that the querySelector selectors are able to to do what everything the getElement(s) selectors are able to do.
Why would you not just use querySelector all the time...?
Steven Parker203,151 Points
Why carry only one tool when your toolbox can hold several?
Sure, querySelector is the "swiss army knife" of selection methods, but in some situations the other methods might be more efficient and/or more clearly convey the program intention to someone reading and maintaining the code.
ian izaguirre3,220 Points
A few more reasons for why you would not always use querySelector:
1) Project Support. getElementById is supported by more older browsers. So if you are working with older code that needs wider browser support, then you would use that. An example, getElementById works with IE5.5 but querySelector is supported starting with IE8.
2) Performance. An example, getElementByClassName and getElementByTagName works faster than querySelectorAll.
3) getElementById is more specific in certain situations then querySelector, since querySelector ONLY returns the FIRST matching element.
Michael Brown12,406 Points
Which is most commonly used or best practice? I'm more familiar with "getElement(s)" by way of Android development, but it seems like querySelector is a beefier option.