Re: [csswg-drafts] More intuitive names for selector performance profiles

> But I disagree that having it only in the non-live profile is useless, as proven by the widely-used selector-based JS libraries like jQuery.

Yup, I used `:has()` a lot back when I was using jQuery. It's quite useful!

> `:nth-last-*` seems more complex, I don't know what browsers do but I guess they use some trick to avoid big performance impacts in most cases.

Mostly it's just that elements don't tend to have very many siblings, so recomputing isn't too expensive.  This is not the case for descendants, which elements often have a lot of (and some obvious use-cases for `:has()` involve using it on the `body` element...)

> It might eventually be possible to add `:has()` to the live profile (maybe imposing some restrictions to its argument?)

It's been suggested (and vaguely approved of by bz, as in he said it wasn't obviously horrible) to have something like `:has-following-siblings()` or `:has-children()`, because it's relatively constrained in how much it has to evaluate and how far up the tree it can invalidate.

> but meanwhile I think it's good that `:has()` in JS is not held back.

Yup!

-- 
GitHub Notification of comment by tabatkins
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/1694#issuecomment-320784244 using your GitHub account

Received on Monday, 7 August 2017 21:21:33 UTC