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

Re: [selectors4] no way to select visible children

From: Marat Tanalin <mtanalin@yandex.ru>
Date: Tue, 21 Jul 2015 02:07:16 +0300
To: Benjamin Poulain <benjamin@webkit.org>, Tab Atkins Jr. <jackalmage@gmail.com>
Cc: Ms2ger <ms2ger@gmail.com>, Aaron Reisman <aaron@hired.com>, "www-style@w3.org" <www-style@w3.org>
Message-Id: <965691437433636@web22m.yandex.ru>
21.07.2015, 00:23, "Benjamin Poulain" <benjamin@webkit.org>:
> On 7/20/15 11:38 AM, Marat Tanalin wrote:
>> š20.07.2015, 21:03, "Tab Atkins Jr." <jackalmage@gmail.com>:
>>> šSuch a thing would tank performance *so bad* and
>>> šthere's no real way to engineer around that.
>>
>> šAre there test implementations and results of performance testing of such implementations? Otherwise that's just guessing.
>
> What Tab said is reasonable. Given the current implementation, there is
> no easy way out.
>
> If you come up with an algorithm that solves the problem in low-order
> polynomial time, share it with us and we can discuss implementation.

There is the `element()` CSS function defined in the css-images-4 draft (with Tab and Elika as editors) [1] and implemented as `-moz-element()` in Firefox/Gecko [2].

According to my tests [3], Firefox successfully prevents infinite loop while still even applying background(s) obtained at first iteration(s).

For implementation details, you can look into source code of Firefox or consult with Mozilla developers who have implemented the feature.

By the way, the css-images-4 draft describes what to do with cycles as well [4].

As an alternative option, I could imagine a mechanism that would just track overall time of entire CSS processing on per-document basis and cancel applying styles once a predefined time threshold is reached -- this could make sense even aside from infinite loops -- just for CSS-heavy (using already existing, currently available CSS features) websites viewed with specific not-enough performant devices.

[1] http://drafts.csswg.org/css-images-4/#element-notation
[2] https://developer.mozilla.org/en-US/docs/Web/CSS/element
[3] http://tanalin.com/_experimentz/w3/css/2015/element-function/
[4] http://drafts.csswg.org/css-images-4/#element-cycles
Received on Monday, 20 July 2015 23:07:49 UTC

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