W3C home > Mailing lists > Public > www-style@w3.org > February 2015

Re: [selectors] Previous-sibling combinator?

From: Benjamin Poulain <benjamin@webkit.org>
Date: Wed, 11 Feb 2015 14:54:07 -0800
Message-ID: <54DBDD8F.7070408@webkit.org>
To: Liam R E Quin <liam@w3.org>, "Tab Atkins Jr." <jackalmage@gmail.com>
CC: Marat Tanalin <mtanalin@yandex.ru>, Clive Chan <doobahead@gmail.com>, Brad Kemper <brad.kemper@gmail.com>, Henrik Andersson <henke@henke37.cjb.net>, www-style list <www-style@w3.org>
On 2/11/15 2:43 PM, Liam R E Quin wrote:
> On Thu, 12 Feb 2015 08:24:03 +1100
> "Tab Atkins Jr." <jackalmage@gmail.com> wrote:
>
>> On Thu, Feb 12, 2015 at 7:18 AM, Marat Tanalin <mtanalin@yandex.ru> wrote:
>> [...]  It hasn't yet been added because
>> it's technically difficult to make it work in a performant manner.
>
> We went through something very similar with reverse selectors in XQuery in streaming environments. I suspect the same research papers on rewriting XPath expressions for performance apply to CSS selectors, except that CSS also I think lacks a parent selector. It turned out that the restrictions XQuery had on XPath "axes" (e.g. following-sibling, preceding-sibling) were not needed, because you could rewrite them all in terms of the ones we had...
>
> Worse, it turned out that users simulated the axes themselves - just as one would in JavaScript in a Web browser - and the simulations were slow and hard to optimize.
>
> To some extent it's better to give people enough rope to tie themselves up and have fun^H^H^Hproblems, better to have completeness, than to have something incomplete where people spend ages publishing weird workarounds that end up even more tangled.

The problem here is quite different from XQuery.

In this case, matching is not really a problem, it is trivial to 
implement and should not be any slower than what already exists.

The problem is doing efficient style invalidation. You don't want a 
single selector to invalidate giant subtrees every time any of its 
element changes.

>
>> a few members are going to
>> investigate what level of restriction would be reasonable and will
>> report back.  It is likely, though, that `el:has(>child)` and
>> `el:has(+sibling)` will end up in the fast profile.  Believe, the list
>> will be notified when we decide on this.
>
> +1
>
>
>
Received on Wednesday, 11 February 2015 22:55:09 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:52:01 UTC