HTML 4.01 Test Suite - Assertions
Testable Assertions: Section 12 Links
12 Links - Hypertext and Media-Independent Links
(must) The retrieval of another Web resource is commonly and implicitly obtained by selecting the link (e.g., by clicking, through keyboard input, etc.).
(must) The destination anchor of a link may be an element within an HTML document.
(must) The href attribute in each source anchor specifies the address of the destination anchor with a URI.
(may) Destination anchors in HTML documents may be specified either by the A element (naming it with the name attribute), or by any other element (naming with the id attribute).
(informative) The roles of a link defined by A or LINK are specified via the rel and rev attributes.
(must) Links specified by LINK are not rendered with the document's contents, although user agents may render them in other ways (e.g., as navigation tools).
(may) The retrieved resource may be handled by the user agent in several ways: by opening a new HTML document in the same user agent window, opening a new HTML document in a different window, starting a new program to handle the resource, etc.
(may) Since the A element has content (text, images, etc.), user agents may render this content in such a way as to indicate the presence of a link (e.g., by underlining the content
(informative) When the name or id attributes of the A element are set, the element defines an anchor that may be the destination of other links.
(informative) The LINK element defines a relationship between the current document and another resource.
(may) The title attribute may be set for both A and LINK to add information about the nature of a link.
(should) The charset attribute allows authors to advise user agents about the encoding of data at the other end of the link.
(should) The hreflang attribute provides user agents with information about the language of a resource at the end of a link, just as the lang attribute provides information about the language of an element's content or attribute values.
(informative) User agents may either locate resources necessary for the correct presentation of the document or, if they cannot locate the resources, they should at least warn the user that the document will be unreadable and explain the cause.
(must) A: name = cdata [CS]
This attribute names the current anchor so that it may be the destination of another link. The value of this attribute must be a unique anchor name. The scope of this name is the current document. Note that this attribute shares the same name space as the id attribute. (See assertion 12.1-10, 12.1-11)
(must) A: href = uri [CT]
This attribute specifies the location of a Web resource, thus defining a link between the current element (the source anchor) and the destination anchor defined by this attribute. (See assertion 12.1.3-3, 12.1.3- 4)
(must) A: hreflang = langcode [CI]
This attribute specifies the base language of the resource designated by href and may only be used when href is specified. (See assertion 12.1.5-2)
(must) A: type = content-type [CI]
This attribute gives an advisory hint as to the content type of the content available at the link target address. It allows user agents to opt to use a fallback mechanism rather than fetch the content if they are advised that they will get content in a content type they do not support.
Authors who use this attribute take responsibility to manage the risk that it may become inconsistent with the content available at the link target address.
(must) A: rel = link-types [CI]
This attribute describes the relationship from the current document to the anchor specified by the href attribute. The value of this attribute is a space-separated list of link types. (See assertion 12.1.2-1)
(must) A: rev = link-types [CI]
This attribute is used to describe a reverse link from the anchor specified by the href attribute to the current document. The value of this attribute is a space-separated list of link types. (See assertion 12.1.2-1)
(must) A: charset = charset [CI]
This attribute specifies the character encoding of the resource designated by the link. Please consult the section on character encodings for more details. (See assertion 12.1.5-1)
(should) The A element's content defines the position of the anchor.
(should) The name attribute names the anchor so that it may be the destination of zero or more links (see also anchors with id).
(should) The href attribute makes this anchor the source anchor of exactly one link.
(should) User agents generally render links in such a way as to make them obvious to users (underlining, reverse video, etc.). The exact rendering depends on the user agent. Rendering may vary according to whether the user has already visited the link or not.
(must) An anchor name is the value of either the name or id attribute when used in the context of anchors.
(must) String matching: Comparisons between fragment identifiers and anchor names must be done by exact (case-sensitive) match.
(must) Links and anchors defined by the A element must not be nested
(may) The id attribute may be used to create an anchor at the start tag of any element (including the A element).
(may) It is permissible to use the id and name attributes to specify an element's unique identifier for the following elements: A, APPLET, FORM, FRAME, IFRAME, IMG, and MAP.
(may) The name attribute may contain character references (See assertion 12.1.1-4)
(should) A reference to an unavailable or unidentifiable resource is an error. Although user agents may vary in how they handle such an error, we recommend the following behavior:
1. If a user agent cannot locate a linked resource, it should alert the user.
2. If a user agent cannot identify the type of a linked resource, it should still attempt to process it. It should alert the user and may allow the user to intervene and identify the document type.
(may) Although LINK has no content, it conveys relationship information that may be rendered by user agents in a variety of ways (e.g., a tool-bar with a drop-down menu of links).
(should) The rel and rev attributes play complementary roles -- the rel attribute specifies a forward link and the rev attribute specifies a reverse link.
(should) When the LINK element links an external style sheet to a document, the type attribute specifies the style sheet language and the media attribute specifies the intended rendering medium or media.
(must) BASE: href = uri [CT]
This attribute specifies an absolute URI that acts as the base URI for resolving relative URIs.
(must) Relative URIs are resolved according to a base URI, which may come from a variety of sources
(must) The BASE element allows authors to specify a document's base URI explicitly.
(must) When present, the BASE element must appear in the HEAD section of an HTML document, before any element that refers to an external source. The path information specified by the BASE element only affects URIs in the document where the element appears.
(must) User agents must calculate the base URI according to the following precedences (highest priority to lowest):
1. The base URI is set by the BASE element.
2. The base URI is given by meta data discovered during a protocol interaction, such as an HTTP header (see [RFC2616]).
3. By default, the base URI is that of the current document. Not all HTML documents have a base URI (e.g., a valid HTML document may appear in an email and may not be designated by a URI). Such HTML documents are considered erroneous if they contain relative URIs and rely on a default base URI.