Skip to content

[selectors] “any <a> or <area> elements are hyperlinks” is incorrect #6957

@simevidas

Description

@simevidas

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…

Source: https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-a-element

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”.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions