Re: Check existence of class names wrote:

> If a tag has an attribute 'class' with a non-existent name (e.g
> because of a typo), neither Markup Validator nor CSS Validator
> catches this.

Such a situation is not an error of any kind, and there really isn't such a 
thing as "non-existent name". A class is defined by the use of a class 
attribute; the class has no other definition in any formal sense, though in 
practice, it might be described in prose, e.g. in comments.

> As an example of a page using a non-existent class name, validate
> Search for <p class="nonexistantclassname">

It's not a particularly bright-looking attribute, but there is nothing a 
validator could or should complain about it.

Even if a markup validator checked the use of a class name in associated 
style sheets (and that's not a validator's job at all - it should parse 
markup, not style sheets or something else) and found out that it's not used 
at all, there is nothing wrong with the appearance of an unused class name, 
or a name that looks unused. It might be included for preparedness, or for 
use in a client-side script, or for use in a user style sheet.


Received on Thursday, 12 August 2010 16:41:57 UTC