[csswg-drafts] [selectors] :local-link should have a more precise name (#10975)

jyasskin has just created a new issue for https://github.com/w3c/csswg-drafts:

== [selectors] :local-link should have a more precise name ==
https://drafts.csswg.org/selectors-4/#the-local-link-pseudo

I noticed this because of @keithamus' [Intent to Prototype](https://groups.google.com/a/chromium.org/g/blink-dev/c/z2Y7O5ZCxgc/m/cj0paGiPAQAJ). I'm concerned because "local" has at least 5 plausible meanings for link targets, with a couple more less-plausible ones, and I don't think the current syntax makes it obvious which you're going to get:

* Links within the same site. (Not in any current CSS proposal, and not necessarily desirable. Arguably the intro text should avoid "[within a site](https://drafts.csswg.org/selectors-4/#the-local-link-pseudo:~:text=within%20a%20site)" to exclude this option.)
* Links within the same origin. (Handled via :local-link(0) in https://drafts.csswg.org/selectors-5/#local-pseudo)
* Links within the same path prefix, ignoring queries. (Handled by :local-link(N) in [selectors-5](https://drafts.csswg.org/selectors-5/#local-pseudo).)
* Links within the same page. (Handled via :local-link on a fragment-less link.)
* Links to the current fragment. (Handled via :local-link on a fragment-ful link.)

And the less-plausible ones:
* A "local" network address (127.0.0.1 or ::1): https://wicg.github.io/private-network-access/#ip-address-space-local
* mdns names (foo.local): https://en.wikipedia.org/wiki/.local

I can see an argument that the desired behavior will tend to follow the fragment-ness of the link, so authors will usually get the right behavior by accident, but it still seems like a footgun that adding `#` to the end of your link will significantly change when this selector matches.

I could imagine :same-site-link, :same-origin-link, :same-page-link, and :same-fragment-link handling the first 4. :same-path-link(N) might handle the 5th: it seems more obvious that the integer argument counts path segments if "path" is mentioned in the selector.

If the WG decides that the current name is right, I don't intend to argue further, but it seems worth double-checking.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/10975 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Monday, 30 September 2024 16:55:34 UTC