[uf-discuss] Microformats, WebApps 1.0 and UI widgets in browsers

Benjamin West bewest at gmail.com
Sun Feb 4 05:16:26 PST 2007


>
> The specific class names are "root" class names. Non-root class names
> (e.g. "title") only make "microformats sense" if they're under the DOM
> tree of a root class name. The root class names have been chosen not
> to conflict with known existing uses [1][2].
>
> Regards, etc...
> David
>
> [1] http://microformats.org/wiki/naming-principles#Unique_Root_Class_Names
> [2] http://microformats.org/wiki/hcard-parsing#root_class_name
>
> --
> David Janes

Exactly.  In other words, instead of looking for an invisible profile
attribute, or some marker in an ancestor, when a top level container
is found, required properties are tested in order to determine whether
or not the element represents what we think it is.

instead of:
function isMicroformat(element) {
  // returns a boolean representing whether or not the given
  // element is the root container of a microformat
  return isRootMFContainer(element);
}

the problem is solved by:
function isMicroformat(element) {
  return isRootMFContainer(element) && hasRequiredProperties(element);
}

This (feature detection) is (or is becoming) a standard idiom that
many javascript developers are familiar with, thanks to sites like
www.quirksmode.org.

Ben West


More information about the microformats-discuss mailing list