Re: [css-selectors] Tagname based substrings

On Wed, Apr 13, 2016 at 12:12 AM, Davis, Greg <greg.davis@pearson.com> wrote:
> So, does this mean that universal selectors are not a good idea from an
> implementation algorithm perspective? From the perspective of a user of CSS,
> I'd definitely rather find a hack for this vs slowing down the whole
> algorithm to get it :)

There are different aspects here. There is the selector matching
itself for a universal selector is almost like a no-op, and there is
the algorithm used to figure out which elements need their style
re-computed for a given change. For the latter, having ".a * {}" is a
_lot_ more expensive (at least in Blink) than having ".a span {}" if
you set class=a on an element with 1000 descendants where only a
couple of those descendants are spans. If you want to know more
details about style invalidations in Blink, [1] is still pretty valid,
I think.

[1] https://docs.google.com/document/d/1vEW86DaeVs4uQzNFI5R-_xS9TcS1Cs_EUsHRSgCHGu8/edit?pli=1#heading=h.xa3ovcncd2vp

-- 
Rune Lillesveen

Received on Wednesday, 13 April 2016 12:14:01 UTC