[csswg-drafts] [selectors] “any <a> or <area> elements are hyperlinks” is incorrect (#6957)

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

== [selectors] “any <a> or <area> elements are hyperlinks” is incorrect ==
I think this information is not entirely correct:

> For example, in HTML5, any `<a>` or `<area>` elements are hyperlinks, and thus match `:any-link`.

Link to section: https://drafts.csswg.org/selectors/#the-any-link-pseudo

According to the HTML Standard, the `<a>` and `<area>` elements are only then hyperlinks if they have an `href` attribute.

> If the `<a>` element has an `href` attribute, then it represents a hyperlink (a hypertext anchor) labeled by its contents.  If the `<a>` element has no `href` attribute, then the element represents a placeholder…

Browsers follow this definition. In browsers, the `:any-link` selector matches `<a href="#">foo</a>` but not `<a>foo</a>`. Therefore, the CSS spec should say “any `<a>` or `<area>` elements **with `href` attributes** are hyperlinks”.


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


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

Received on Sunday, 16 January 2022 09:23:07 UTC