[uf-discuss] Re: Possible alternative methods for "include"

Toby A Inkster mail at tobyinkster.co.uk
Tue Feb 5 08:23:42 PST 2008

Tantek =?ISO-8859-1?B?xw==?=elik wrote:

> 1. class is an unordered set of values per HTML4.  introducing ordering
> is a non-starter both from a violation of HTML4 spec perspective and
> likely requiring of rewriting HTML4 parsers to maintain an ordering
> where they currently don't.

A reading of HTML 4.01, section 7.5.2 doesn't seem to claim that the class 
list is unordered. 

It does claim that it's a "set" of class names, and in mathematical 
parlance sets are unordered by definition, and must not contain 
duplicates, but it's unlikely that the framers of the HTML 4.01 spec 
intended the world "set" to be interpreted in that way -- far more likely 
they were referring to the layman's definition of the word.

As far as parsers are concerned, DOM Level 2 HTML provides as "className" 
property as part of the HTMLElement interface, which is either directly 
used or is inherited by all DOM element nodes. The className is a string 
exactly reflecting the contents of the HTML class attribute, so should 
reflect their original order.

And any non-DOM, naive SGML or XML parser that encounters a class 
attribute will just parse it as a plain old string anyway, so the order 
should be retained.

I can't think of a single HTML parser that is only able to provide access 
to the class attribute as an unordered set. If any such parser exists, 
please enlighten me.

> 2. inclusion of arbitrary data (#baz) in the class attribute is a
> documented anti-pattern.
> http://microformats.org/wiki/anti-patterns#data_in_class_attributes

This anti-pattern is only mentioned as a subheading to the more general 
anti-pattern of invisble metadata. My suggested pattern for inclusions 
does not hide metadata -- it merely references metadata elsewhere on the 
page. It is no more guilty of hiding metadata than any other suggested 
include pattern, so I fail to see how this is relevant.

Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux, up 6 days, 22:24.]

                             The World in 2050?

More information about the microformats-discuss mailing list