Re: Check existence of class names

Am 12.08.2010 18:39, schrieb Andreas Prilop:
> > On Thu, 12 Aug 2010, Vladimir Chukharev wrote:
> >>> If a tag has an attribute 'class' with a non-existent name
> >> There is nothing wrong with this!
> >Exactly. A non existent class name does not exist, as the name already
> suggests. So, as soon as a class name is set, this class name exists.

By a 'non-existent class name' I meant a name of a non existent class,
not a non existent name of some class. Sorry if this goes wrong with you.
I am not a native English speaker after all.

> I think this comes from the idea that class names are mainly or only to
> be used as handles for styling. Unfortunately the w3c docs suggest this
> idea. I think, it should be clearly stated that class names are

I do not see how w3c docs suggest this. They are talking about both sides,
to my mind.

> primarily for adding semantics and only secondary as style handles. Then
> it would be clear that class names may intentionally be given to enhance
> semantics without ever wanting to style that in any special way.

> Similar for ID's.

> So for example let's take just some sentence: "Albert Einstein invented
> the atom bomb". In html, you might write this as:

> <span class="vcard fn">Albert Einstein</span> invented the atom bomb.

> Although there is no need to specially style the words "Albert
> Einstein". But using this markup, this adds the semantic to "Albert
> Einstein", that this is a name. A name of a person. This is what classes
> should be for.

This does not go wrong but is irrelevant, since it's correct only while
you are not using the semantics you have added. When you start to use it,
you need consistency between different usages of the classes. E.g. if you
collect/visualize/do_whatever with names of persons, you need them all marked
with class="vcard fn". Those accidentally marked with class="wcard fn" or
class="vcard_fn" or many other possible typos, have different semantics.

To repeat: notifications and warnings are not fatal errors, you can disregard
them if you are not interested in them, while others might get some help from
them.

-- 
Vladimir Chukharev
Tampere University of Technology

Received on Tuesday, 17 August 2010 16:35:47 UTC