implementation-guidelines
Revision as of 04:01, 30 July 2005 by MarkRickerby (talk | contribs)
Guidelines and Strategies for Implementing Microformats
Identification
Javascript/XPath example which runs in Mozilla:
var mf = 'hreview'; var micropath = "//*[contains(@class,'" + mf + "')]"; var micromatch = new RegExp('\\b' + mf + '\\b'); var mc = document.evaluate(micropath, document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); for (var i = 0; i < mc.snapshotLength; i++) { iNode = mc.snapshotItem(i); if (iNode.className.match(micromatch)) doSomething(); }