Skip to content

Comment on Don’t use IDs in CSS selectors? (2011)parent

Comments

Did you read the article? It said explicitly that regardless of `div.class a` or `div#id a` the same lookup takes place - every anchor on the page's parent is checked to see if it has the id or class specified by the selector.

So the selector `a#id` will be faster than `a.class` but a parent selector uses the same heuristic.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.