Re: HTML Testcase for W3 validator

2012-05-31 15:44, David Dorward wrote:

> Character data is allowed directly inside the body element in XHTML 1.0 Transitional [...]
>
> It isn't, however, in XHTML 1.0 Strict, so if you were using that instead of the
> Transitional DTD then the validator would have flagged it.

Yes, in Strict, <body><p>text</p>.<p>text</p></body> is a syntax error.

However, the usefulness of this, in detecting typing mistakes, is 
limited. Typically, authors wrap content in <div> containers, for the 
purposes of styling (and scripting). Consider a typical scenario:

<body>
   <div class="header">some stuff</div>
   <div class="nav">some stuff</div>
   <div class="content">
     <p>text</p>.<p>text</p>
   </div>
   <div class="footer">some stuff</div>
</body>

There will be no error message about the "." character between the 
paragraphs even in Strict, because now it's not text content directly 
inside <body>. There's the intervening <div> element, and inside it, 
direct text content is allowed.

(X)HTML syntax is too permissive to let us catch issues like 
<p>text</p>.<p>text</p> in general.

Yucca

Received on Saturday, 2 June 2012 07:54:25 UTC