Re: Validation tool

18.5.2011 15:15, M. Wacquier wrote:

> After validating our site[ <http://www.biggestleaf.com/ ]
 > with the validator we found 12 errors.. One of
> them was the following:
>
>   Line 126, Column 4: end tag for element "p" which is not open
>
> </p></div>

It's apparently just a spurious </p> tag, which you can and should 
remove. (Although homeless end tags are mostly ignored, there's a chance 
that some browser might treat </p> as a "command" that ends a paragraph, 
thereby causing an empty line to be added to the rendering.)

Usually it is best to deal with validator error messages sequentially, 
as an error may well cause problems later on, too. Fixing one error may 
thus fix several error messages. (This is not such a case, though.)

> We decided to use the built-in tool of Wordpress to clean the messy
> code. Unfortunately, none of the errors have been resolved.

Apparently it does not clean very well

> My question is whether W3 has a tool to implement in Wordpress to clean
> messy code?

I don't think such issues fall into the scope of W3C activities. At 
most, the W3C might inform about utilities available somewhere. But 
maintaining lists of links to useful software on some topic tends to be 
hard work - it is not rare to see that within a year, half of your links 
died because someone moved or renamed a page or site without setting up 
redirects. Besides, there's the quality issue. People too easily take 
links as recommendations.

Anyway, in your case, 10 out of the 12 errors are just about </p> and 
thus easy to fix. The remaining two are more difficult, and it is 
difficult to imagine how any cleanup software could handle them.

The first one is about a <pre> element containing elements that are not 
allowed there. As <pre> is supposed to be rendered in a monospace font, 
preserving spaces and linebreaks as they are, it would be rather odd to 
put e.g. <dl> there, and such markup has been forbidden syntactically. 
It's difficult to guess why you are using <pre> here, and there's surely 
a better way. But a _simple_ fix would be to use <div 
class="pre">...</div> instead of <pre>...</pre> and to add
.pre { white-space: pre; }
This has the same effect as <pre>, except for monospace font, which you 
are overriding anyway.

The last error message is about the attribute async="true" in a <script> 
element. This is not a cleanup issue, because the attribute just isn't 
allowed by any published HTML specification. The HTML5 draft defines an 
async attribute, but even according to it, async="true" is not allowed; 
the attribute is "boolean" (a misnomer term in HTML5), and the only 
alternatives are async (with no value set - only in HTML linearization 
of HTML5), async="" (with an empty value), and async="async". But the 
page contains some features that are allowed in HTML 4 but not in HTML5, 
so maybe it's best that you just leave _this_ error unfixed.

On the other hand, you could use defer="defer" instead (or in addition). 
It does not give the same efficiency as async="async", but at least it 
makes the processing of the script element non-blocking.

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

Received on Monday, 23 May 2011 07:21:12 UTC