Thursday 14 June 2007

W3C Validator is not infallible

If you want your pages to be considered valid, you probably use W3C's mark-up validator. This thing is pretty smart - even though some of its messages don't make a lot of sense.

I used to think it was infallible, but I should have known better. Like CSS and JavaScript inconsistencies across browsers, the W3C validator is also not quite perfect.

I recently used to it validate some php pages. Obviously, the validator only validated the X/HTML that was rendered, but it failed to pick up the following slips.

I had to edit what was a textarea, to make it a simple text input box:

ORIGNAL CODE:

<td class="hr"><textarea name="street_address_1" rows="4" cols="35" maxlength="100"><?php echo str_replace('"', '"', trim($row["street_address_1"])) ?></textarea></td>


EDITED CODE:

<td class="hr"><input maxlength="100"
name="street_address_1"></textarea></td>


Even though I had failed to remove the </textarea> tag in my edited version, my page validated.

On top of this, I had a few instances of
<input type="checkbox" value="Yes" name="is_publisher">

The validator ignored the fact I hadn't closed the tag, and I'm pretty sure that's a basic requirement of XHTML 1.0 Strict Mark-up!?

No comments: