User:Mkaply:Fx-Docs:Microformats/Architecture
Access to microformats and the microformats APIs will be via the global Microformats object.
The following APIs will be available for accessing microformat content from a web page:
/** * Retrieves microformats objects of the given type from a document * * @param name The name of the microformat (required) * @param rootElement The DOM element at which to start searching (optional - defaults to content.document) * @param recurseFrames Whether or not to search child frames for microformats (optional - defaults to true) * @param microformats An array of microformat objects to which is added the results (optional) * @return A new array of microformat objects or the passed in microformat * object array with the new objects added */ get: function(name, rootElement, recurseFrames, microformats) {
/** * Counts microformats objects of the given type from a document * * @param name The name of the microformat (required) * @param rootElement The DOM element at which to start searching (optional - defaults to content.document) * @param recurseFrames Whether or not to search child frames for microformats (optional - defaults to true) * @param count The current count * @return The new count */ count: function(name, rootElement, recurseFrames, count) {
/** * Returns true if the passed in node is a microformat. Does NOT return true * if the passed in node is a child of a microformat. * * @param node DOM node to check * @return true if the node is a microformat, false if it is not */ isMicroformat: function(node) {
/** * If the passed in node is contained in a microformat, this function returns * the microformat that contains it. If the passed in node is a microformat, * it still returns the parent. * * @param node DOM node to check * @return If the node is contained in a microformat, it returns the parent * DOM node, otherwise returns nothing */ getParent: function(node) {
/** * If the passed in node is a microformat, this function returns a space * separated list of the microformat names that correspond to this node * * @param node DOM node to check * @return If the node is a microformat, a space separated list of microformat * names, otherwise returns nothing */ getMicroformatNamesFromNode: function(node) {
The following APIs will be available as helper APIs, primarily for working with the data in a microformat: