[uf-discuss] DOM scripting as an alternative to include-pattern?

Michael Leikam leikam at yahoo.com
Fri Jun 2 20:08:38 PDT 2006


I'm new to the list and microformats so I don't know if
you've discussed this already.  It seems to me that when
compared to the include-pattern convention[1], DOM
scripting is a lot more robust and widespread.  The
include-pattern rules strikes me as one very small DOM
manipulation, so I'm wondering why we don't just adopt the
whole thing?

If I were parsing an hCard on the client side, the way I'd
copy text or element trees into an hCard/hResume block is
by writing a bit of DOM-manipulating javascript that was
triggered by an event (e.g., when the page is parsed by a
microformats-aware parser).  If I could markup a
microformat-significant tag with an event handler that
parsers would understand, I could both define and call a
transformation pretty easily.

This approach would solve the "common organization name
which exists outside my hCard" as well as the "Location
data which exists outside my vevent" problems.  It would
expose text, descendant trees and tag attribute/value pairs
(the last of which I think are opaque with the
include-pattern approach).

Here's a use case: I'm considering marking up a page like
my Biology Schedule of Classes[2] as hCalendar events.

Inserting <object> tags for this purpose is a non-starter
in part because I would need to include too many elements
which are outside of an event row (e.g., term, course
title, section group).  Reformatting the tables to include
the relevant text, either hidden or visible to the user, is
likewise no good because it would be extremely redundant
and not helpful to students.  The page is understandable to
people; it's just the transition to iCalendar that needs
the help.

Also, because of the production process, there are pieces
of the page which I don't have direct access to, so while I
can reach them via DOM traversals, I can't put a container
around the relevant node much less tag it with a globally
unique ID.  I know others working with output from
enterprise-class apps run into the same limitation.

So what do you guys think?


[1] http://microformats.org/wiki/include-pattern

More information about the microformats-discuss mailing list