Describing microformats in JavaScript

  • Revision slug: Describing_microformats_in_JavaScript
  • Revision title: Describing microformats in JavaScript
  • Revision id: 166735
  • Created:
  • Creator: Sheppy
  • Is current revision? No
  • Comment added some tweaks based on notes from mkaply - more to come

Revision Content

{{template.Fx_minversion_header(3)}} {{template.Draft()}} Microformats are described in JavaScript by using a standardized structure format that has several standard members that describe the object.

Microformat definition format

The microformat definition must contain the following entries:

mfVersion
Specifies the version number of the microformat API to which the definition was written. For Firefox 3, this should be set to 0.8.
mfObject
The JavaScript object that implements the microformat.
className
A string specifying the name of the microformat's class as referenced in HTML (class="className").
required
An array indicating the names of any properties that must be specified. This may be left out if all properties are optional.
properties
A structure describing the properties of the microformat.

Property specifications

Each property in the properties structure is specified by its name, and may include additional attributes if the property so requires. Standard attributes are:

plural
A boolean value indicating that, if true indicates that the property can have multiple values. If a property is plural, it is returned as an array.
virtual
A boolean value indicating whether or not the property is virtual. If it's virtual, the virtualGetter() method will be called to attempt to create the property if it doesn't exist.
dataType
The type of data contained by the property. Possible values are:
dateTime
An ISO date
anyURI
A URI
email
An email address
tel
A telephone number
HTML
HTML including tags
float
A floating-point number
microformat
A microformat
custom
Custom data

See also

Using microformats, Parsing microformats in JavaScript

Revision Source

<p>{{template.Fx_minversion_header(3)}}
{{template.Draft()}}
Microformats are described in JavaScript by using a standardized structure format that has several standard members that describe the object.
</p>
<h3 name="Microformat_definition_format">Microformat definition format</h3>
<p>The microformat definition must contain the following entries:
</p>
<dl><dt><code>mfVersion</code>
</dt><dd>Specifies the version number of the microformat API to which the definition was written. For Firefox 3, this should be set to 0.8.
</dd><dt><code>mfObject</code>
</dt><dd>The JavaScript object that implements the microformat.
</dd><dt><code>className</code>
</dt><dd>A string specifying the name of the microformat's class as referenced in HTML (<code>class="<i>className</i>"</code>).
</dd><dt><code>required</code>
</dt><dd>An array indicating the names of any properties that must be specified.  This may be left out if all properties are optional.
</dd><dt><code>properties</code>
</dt><dd>A structure describing the properties of the microformat.
</dd></dl>
<h3 name="Property_specifications">Property specifications</h3>
<p>Each property in the <code>properties</code> structure is specified by its name, and may include additional attributes if the property so requires.  Standard attributes are:
</p>
<dl><dt><code>plural</code>
</dt><dd>A boolean value indicating that, if <code>true</code> indicates that the property can have multiple values.  If a property is plural, it is returned as an array.
</dd><dt><code>virtual</code>
</dt><dd>A boolean value indicating whether or not the property is virtual.  If it's virtual, the <code>virtualGetter()</code> method will be called to attempt to create the property if it doesn't exist.
</dd><dt><code>dataType</code>
</dt><dd>The type of data contained by the property.  Possible values are:<blockquote>
</blockquote></dd><dt><code>dateTime</code>
</dt><dd>An ISO date
</dd><dt><code>anyURI</code>
</dt><dd>A URI
</dd><dt><code>email</code>
</dt><dd>An email address
</dd><dt><code>tel</code>
</dt><dd>A telephone number
</dd><dt><code>HTML</code>
</dt><dd>HTML including tags
</dd><dt><code>float</code>
</dt><dd>A floating-point number
</dd><dt><code>microformat</code>
</dt><dd>A microformat
</dd><dt><code>custom</code>
</dt><dd>Custom data
</dd></dl>
<h3 name="See_also">See also</h3>
<p><a href="en/Using_microformats">Using microformats</a>, <a href="en/Parsing_microformats_in_JavaScript">Parsing microformats in JavaScript</a>
</p>
Revert to this revision