W3C home > Mailing lists > Public > www-style@w3.org > April 2016

Re: [css-selectors] Tagname based substrings

From: Rune Lillesveen <rune@opera.com>
Date: Wed, 13 Apr 2016 14:13:32 +0200
Message-ID: <CANz6XvSWNnQuLtWHqsrERG+LVDixqD52it2Wcgz1enDtHXfKxg@mail.gmail.com>
To: "Davis, Greg" <greg.davis@pearson.com>
Cc: "Tab Atkins Jr." <jackalmage@gmail.com>, Francois Remy <francois.remy.dev@outlook.com>, Simon Pieters <simonp@opera.com>, www-style list <www-style@w3.org>, Marat Tanalin <mtanalin@yandex.ru>
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

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:09:02 UTC