[csswg-drafts] [selectors] :link and <link> (#3817)

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

== [selectors] :link and <link> ==
Sorry for the issue title, it was just a good opportunity.

So, the following testcase:

```html
<style>
  body { margin: 0 }
  a, head, link { display: block }
  a, link { width: 100px; height: 100px; background-color: red }
  :link { background-color: blue }
  :visited { background-color: purple }
</style>
<link href="unvisited"></a>
<link href="">
<a href="unvisited"></a>
<a href=""></a>
```

Renders as follows in UAs:

 * Firefox and WebKit: blue, purple, blue, purple
 * Edge: blue, blue, blue, purple
 * Blink: red, red, blue, purple

I think per spec (https://drafts.csswg.org/selectors-4/#location) Firefox and WebKit are right. However, I don't see any use-case for letting `<link>`s match `:visited`, and I have an internal use-case in Firefox where Blink or Edge's behavior would save us some trouble (https://bugzilla.mozilla.org/show_bug.cgi?id=1495621#c20).

Arguably that Firefox case can't arise in the web, and we can work around it in different ways, but I wonder if there'd be interest here in either making `<link>`s never match `:visited`, or making them not match any of `:link` / `:visited` / `:any-link`.

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

Received on Wednesday, 10 April 2019 13:50:56 UTC