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

> `URLPattern` could be a super interesting way to handle this. It could cover many (all?) use cases with just one argument, and might effectively reduce the selector syntax-space down to `:self-link(<string>)` where the `<string>` is the effective `URLPatternInput`. We could also crib from attirbute selectors allowing for `:self-link(<string> i)` for case-insensitive matches.

Presumably relative links would resolve relative to the document, right? 

> One slight concern might be perf, given how much more complex `URLPattern` is, but the selector will likely only match once per page (modulo calls to `pushState`/`replaceState`).

Also `haschange`, but yeah, still way less frequent than the invalidation of other pseudo-classes, so I don't think performance is a concern here. My only (minor) concern is usability, it would help write out syntax examples of syntax for each of the use cases listed above.

> Is there a privacy concern? I don't think there is a way for a CSS file to currently effectively exfiltrate the current page the user is on. Allowing `URLPattern` matching selectors would make that a lot easier - is that a problem, though?

Given that no privacy concern has been expressed about the existing syntax (AFAIK) I doubt it.

> I really like the idea.

Same. It's a more powerful syntax, more portable (authors can reuse knowledge from other parts of the platform) and adds less API surface. I love it!

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


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

Received on Saturday, 25 January 2025 22:40:39 UTC