When using selectors in CSS and in jQuery, are there any efficiency differences between using'E#id' and #id, where E is any HTML element? If yes, does it only apply to certain layout engines and/or Javascript engines?
When using selectors in CSS and in jQuery, are there any efficiency differences between
Share
Browsers read the selectors right to left so there is little to be gained by prefixing anything before the id; it is redundant at that point. Source:
Writing Efficient CSS from Mozilla
Here’s a real world example to test it for yourself. TL:DR; it doesn’t seem to matter enough to make a difference.
Relevant further reading from a previous Stack Overflow question