W3C home > Mailing lists > Public > www-validator@w3.org > September 2013

Re: Validator didn't see that I nested the meta tags in the title tags

From: Jukka K. Korpela <jkorpela@cs.tut.fi>
Date: Mon, 23 Sep 2013 20:34:43 +0300
Message-ID: <52407BB3.1020502@cs.tut.fi>
To: Eric Roxas <eroxy93@gmail.com>
CC: www-validator@w3.org
2013-09-23 13:33, Eric Roxas wrote:

> This didn't come out as an error.

It isn't an error

> <!doctype html>
> <html>
> 	<head>
> 		<title>
> 			Journey with a segway
> 		<meta charset="utf-8">
> 		<link type="text/css" rel="stylesheet" href="journal.css">
> 		</title>

This is valid, because the content of the title element is treated as 
plain text. Only the end tag </title> is recognized; otherwise, 
everything is taken as-is, except that character references (like 
&eacute; and &#x123;) are parsed and interpreted.

You can see what happens in browsers by appending the following to the 
document:

<script>
console.log(document.title)
</script>

When you look at the console log, you will see

Journey with a segway <meta charset="utf-8"> <link type="text/css" 
rel="stylesheet" href="journal.css">

and this is also used as the title otherwise. The <meta> and <link> tags 
are not recognized here at all.

It might be a good idea to issue a warning when the title element 
contains the less-than character "<". Cases where the title 
intentionally contains that character must be very rare as compared with 
unintentional appearances (often caused by attempts to use markup inside 
the element).

Yucca
Received on Monday, 23 September 2013 17:35:14 UTC

This archive was generated by hypermail 2.3.1 : Monday, 23 September 2013 17:35:21 UTC