Re: Passed validation with wrong markup....

On Tue, 4 Sep 2007, David Dorward wrote:

>> So why is it that the w3c validator gives a passed validation for a sloppy 
>> code?
> Because, in HTML, the value of the href attribute is allowed to contain 
> backslash characters. It might not mean what was intended, but that doesn't 
> make it invalid.

There are two meanings for "allowed" that are relevant here.

The formal syntax (DTD) of HTML basically allows any characters inside an 
href attribute value, since the attribute is declared as CDATA (character 
data). This is what matters in validation.

The prose of HTML specifications may impose further restrictions on such 
attribute values. Such restrictions are not covered in validation.

The restrictions can be indirect. The href attribute value is a URL (or 
"URI"), so what's "allowed" there - in a sense that is irrelevant to 
validation but quite relevant otherwise - depends on the URL 
specifications. The "\" character used to be disallowed, but current URL 
specification allows it - though _not_ as a synonym for "/".

Checking href attribute values is something quite different from markup 
validation. You can use a link checker for the purpose, though it probably 
checks that the URL "works" rather than its syntactic correctness.

-- 
Jukka "Yucca" Korpela, http://www.cs.tut.fi/~jkorpela/

Received on Tuesday, 4 September 2007 13:15:32 UTC