Re: Error checking attribute ALT

On May 7, 2009, at 18:09, Jukka K. Korpela wrote:

> Well, it's rather the odd kludge embedded into the validator that  
> does some checks and decides to issue opinions on such grounds - if  
> you have chosen to use the "HTML5" feature.

The HTML5 spec says that alt is allowed on <input> only if it has  
type=image. What's odd about checking for that constraint in an HTML5  
validator?

> I'm not against experiments and heuristic checkers ("linters"), but  
> I'm against confusing people about the already confused issue of  
> markup validation. The "HTML5" feature has just been packged  
> together with a markup validator.

What's confusing people about the issue of markup validation?

> If you are serious about HTML5, then the feature might be useful to  
> you.
>
> Oddly enough, when I tested a document containing <input alt="">,  
> the "HTML5" feature told me:
>
> Line 7, Column 22: Required attributes missing on element input.
> <div><input alt="foo"></div>Element-specific attributes for element  
> input:
>
> followed by a list of attributes

That's because if you have the alt attribute, you must also have  
type=image. Hence, a required attribute is missing (required once the  
validator has committed to a derivation that has alt).

> (as links that don't work)

I need to look into that. Thanks.

> When I played more by adding type=text (completely redundant by all  
> HTML specifications), then it started complaining about the alt  
> attribute.

Right, because then the validator first committed to a derivation that  
had type=text.

These are logical even if a bit user unfriendly outcomes of an  
implementation of
http://www.thaiopensource.com/relaxng/derivative.html

Note that the HTML5 validator permutes the attributes so that the  
RELAX NG derivative algorithm always sees the type attribute first, if  
present, to make the RELAX NG validator commit to a more intuitive  
derivation first. However, this fails when the type attribute is  
missing.

-- 
Henri Sivonen
hsivonen@iki.fi
http://hsivonen.iki.fi/

Received on Wednesday, 13 May 2009 11:42:36 UTC