On Wed, 8 Jan 2025 23:47:10 GMT, Michael Strauß <mstra...@openjdk.org> wrote:

>> The CSS Selectors specification defines the `:root` pseudo-class that 
>> matches root nodes:
>> https://www.w3.org/TR/selectors-4/#the-root-pseudo
>> 
>> JavaFX uses the non-standard `.root` style class for the same purpose. We 
>> should also support the `:root` pseudo-class for increased compatibility of 
>> JavaFX CSS with the web specification.
>> 
>> Additionally, we should also support the following child-indexed 
>> pseudo-classes:
>> `:first-child`
>> `:last-child`
>> `:only-child`
>> `:nth-child()` with arguments `even` and `odd`
>> 
>> The `An+B [of S]?` microsyntax for `:nth-child()` is not supported, as this 
>> would require major changes in JavaFX CSS.
>
> Michael Strauß has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   updated cssref

This outcome is what I would expect, and it puts an upper limit on the number 
of nodes that you can front-insert one by one into a container (the time 
complexity grows quadratically, so you'll pretty soon freeze the application).

Note that back-inserting, or bulk-inserting nodes should have no noticeable 
performance impact.

I think our options are the following:

1. Discard this feature.
2. Accept that this particular way of adding nodes to a container has a 
prohibitive time complexity for many nodes.
3. Do something clever, for example only toggle the pseudo-classes once per 
pulse. The disadvantage of this approach would be that the pseudo-classes of a 
node may be wrong after it is added to a container, and would then later fix 
themselves in the next pulse.
4. Do something even more clever, for example only set the pseudo-classes when 
someone is actually listening or retrieving their value.

-------------

PR Comment: https://git.openjdk.org/jfx/pull/1652#issuecomment-2581034955

Reply via email to