Skip to content

Latest commit

 

History

History
196 lines (141 loc) · 4.07 KB

page-has-title-2779a5.md

File metadata and controls

196 lines (141 loc) · 4.07 KB
id name description success_criterion test_aspects authors
2779a5
HTML Page has a title
This rule checks that the HTML page has a title
2.4.2
DOM Tree
Wilco Fiers
Stein Erik Skotkjerra
Bryn Anderson
Anne Thyme Nørregaard
Jey Nandakumar

Test procedure

Applicability

The rule applies to any page where the document element is an html element, and where the page is not embedded in another page.

Note: Pages may be embedded inside other pages through elements such as iframe and object elements.

Expectation 1

The document element has at least one descendant that is an HTML title element.

Note: The title element exists in other namespaces such as SVG. These are not HTML title elements and should be ignored for this rule.

Expectation 2

The first HTML title element that is a descendant of the document element has children that are text nodes that are not only whitespace.

Assumptions

There are currently no assumptions

Accessibility Support

There are no major accessibility support issues known for this rule.

Background

Test Cases

Passed

Passed example 1

This page has a title with content.

<html>
	<title>This page has a title</title>
</html>

Passed example 2

This page gives a title to an iframe.

<html>
	<title>This page gives a title to an iframe</title>
	<iframe src="../test-assets/sc2-4-2-title-page-without-title.html"></iframe>
</html>

Passed example 3

This page has two title elements.

<html>
	<head>
		<title>Title of the page.</title>
	</head>
	<body>
		<title>Title of the page.</title>
	</body>
</html>

Passed example 4

The title is in the body.

<html>
	<body>
		<title>Title of the page.</title>
	</body>
</html>

Passed example 5

The first title element has content.

<html>
	<head>
		<title>Title of the page.</title>
	</head>
	<body>
		<title></title>
	</body>
</html>

Passed example 6

The title only contains characters that are not letters or numbers.

<html>
	<title>#$@&%*!</title>
</html>

Failed

Failed example 1

The page has no title.

<html>
	<h1>this page has no title</h1>
</html>

Failed example 2

The title element is empty.

<html>
	<title></title>
</html>

Failed example 3

The page has no title.

<html>
	<iframe src="../test-assets/sc2-4-2-title-page-with-title.html"></iframe>
</html>

Failed example 4

The first title element is empty.

<html>
	<head>
		<title></title>
	</head>
	<body>
		<title>Title of the page.</title>
	</body>
</html>

Failed example 5

The title only contains a separator character.

<html>
	<title> </title>
</html>

Inapplicable

Inapplicable example 1

This rule is not applicable to svg elements.

<svg xmlns="http://www.w3.org/2000/svg">
  <title>This is an SVG</title>
</svg>