Universal selector isn't slow by itself
Francisc opened this issue · 2 comments
Francisc commented
In Selectors->Performance you advise against using the universal selector (*{}).
That's actually not true if the selector is just *{} as that is pretty fast. As fast as an element selector some say.
What's slow is this: div *{} and the deeper it goes it gets even slower because of browsers reading from right to left meaning it first gets all elements, then checks which of them are inside a div for each of them, going up until the parent HTML node looking for a div.
csswizardry commented
Of course, you are correct. I shall word it a little more carefully, thanks!
Francisc commented
Just finished reading it and enjoyed it.
Thank you.