[uf-discuss] Simplifying hierarchy in hCard

Chris Messina chris.messina at gmail.com
Wed Mar 29 12:40:43 PST 2006


Actually, I've wondered this myself and think that people will
actually do this regardless...

So while I take your point Tantek, I think allowing this actually
makes sense. Parsers should treat combined microformats and objects as
non-nested objects... basically the equivalent behavior of shorthand
CSS styles:

background-color: #fff;
background-image: url(image.gif);
background-repeat: no-repeat;

and

background: url(image.gif) no-repeat #fff;

Therefore, using:

<span class="author vcard fn">My Name</span>

would be the equivalent of

<span class="author vcard"><span class="fn">My Name</span></span>

...except that it wouldn't be nestable.

This saves a bunch of code and writing and makes for a more elegant
solution, IMO.

I've tried using hcards in my blog posts and it's just a ton to write
out (with or without widgets). Ideally, this is how I could do the
hcard thing in a post:

<a class="vcard fn url" rel="met friend contact"
href="http://tantek.com">Tantek</a>

That's the use case that I would design this for. Since you can't nest
anchors anyway, this seems the ideal application of this concept.

Chris

On 3/29/06, Tantek Çelik <tantek at cs.stanford.edu> wrote:
> On 3/29/06 3:14 AM, "David Janes -- BlogMatrix" <davidjanes at blogmatrix.com>
> wrote:
>
> > From the hatom-issues [1] discussion, Tantek writes:
> >
> > | You can actually simplify that (one fewer span) with:
> > | <span class="author vcard"><span class="fn">My Name</span></span>
> >
> > Why shouldn't hCard support <span class="author vcard fn">My
> > Name</span>? I.e. do we gain anything by that extra layer of hierarchy
> > of spans?
>
> David, this has been asked (at least once) before on the list (we should
> probably add this to the microformats FAQ[1] and/or the hCard FAQ [2]), and
> the short answer is, it breaks the ability to nest microformats.  E.g. even
> with just hCard, we can put an hCard inside another hCard as its AGENT, and
> that becomes impossible to parse if you collapse a property element (such as
> fn) with the root class name element (vcard) itself, because then it becomes
> ambiguous which hCard the "fn" applies to (the outer hCard, or the "agent"
> hCard).
>
> In short, properties of a microformat MUST go in descendant elements
> *inside* the root class element of that microformat.  Similarly with
> subproperties of a property (e.g. "region" must be on a descendant of
> "adr").
>
> Thanks,
>
> Tantek
>
> [1] http://microformats.org/wiki/faq
>
> [2] http://microformats.org/wiki/hcard-faq
>
> _______________________________________________
> microformats-discuss mailing list
> microformats-discuss at microformats.org
> http://microformats.org/mailman/listinfo/microformats-discuss
>


More information about the microformats-discuss mailing list