Re: [selectors] :any-link, :link and :visited should not match HTML's <link>

On Aug 12, 2014, at 9:05 PM, Boris Zbarsky <bzbarsky@MIT.EDU> wrote:
> On 8/12/14, 8:18 PM, Benjamin Poulain wrote:
>> In the definition of :any-link (http://dev.w3.org/csswg/selectors4/#the-any-link-pseudo), the text explicitly mentions the elements it matches for HTML5: <a>, <area> and <link>. I don’t see why matching <link> is useful in that context since it does not have a visual representation.
> 
> By default.  You can render it just fine in practice.  Here's a simple example:
> 
>  <!DOCTYPE html>
>  <style>
>    head,link { display: block }
>    link::before { content: attr(href) }
>  </style>
>  <link href="http://example.org">
> 
> Of course if you try that testcase you'll see even more behavior differences between browsers in terms of whether the <link> is treated as a link or not...
> 
>> I suggest removing <link> and limiting the 3 selectors to visual content.
> 
> Please do note http://www.whatwg.org/specs/web-apps/current-work/multipage/scripting.html#selector-link for what the HTML spec has to say on the matter.

I understand Firefox does things differently, but what is the rationale behind that?
Is there a new role for <link> I am unaware of? Is it intended to replace <a> in some cases?

If you use -moz-any-link with querySelector on Firefox, half of the results are for stylesheets which is never what authors want.

Benjamin

Received on Wednesday, 13 August 2014 20:18:46 UTC