Documentation for a historical release of Infusion: 1.3
Please view the Infusion Documentation site for the latest documentation.
If you're looking for Fluid Project coordination, design, communication, etc, try the Fluid Project Wiki.

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 34 Next »

This documentation is quite incomplete. At the moment, it is simply a holding place for various bits of documentation that don't have a proper home yet.

The Fluid framework includes a number of functions and utilities that component developers can avail themselves of. These are described below.

On This Page


fluid.accumulate(list, fn, arg)

Scan through a list of objects, "accumulating" a value over them (may be a straightforward "sum" or some other chained computation). The results will be added to the initial value passed in by "arg" and returned.

  • list {Array}: The list of objects to be accumulated over
  • fn {Function}: An "accumulation function" accepting the signature (object, total, index) where object is the list member, total is the "running total" object (which is the return value form the previous function), and index is the index number.
  • arg {Object}: The initial value for the "running total" object

Return: arg


Allocate an id to the supplied element if it has none already, by a simple scheme resulting in ids "fluid-id-nnnn" where nnnn is an increasing integer.

  • element {Element}: The element to place the simple id.

Return: String (representing the id)

fluid.byId(id, dokkument)

Returns a DOM element quickly, given an id.

  • id {Object}: The id of the DOM node to find
  • dokkument {Document}: the document in which it is to be found (if left empty, use the current document)

Return: Element or null if none exists

See also: fluid.jById


Clears an object or array of its contents. For objects, each property is deleted.

  • target {Object|Array}: Either an object or an array whose contents you wish to clear


A special "marker object" which is recognized as one of the arguments to fluid.initSubComponents. This object is recognized by reference equality - where it is found, it is replaced in the actual argument position supplied to the specific subcomponent instance, with the particular options block for that instance attached to the overall "that" object.

Constant: {}

See also: fluid.initSubComponents


Fetches a single container element and returns it as a jQuery.

  • containerSpec {String||jQuery||Element}

Return: jQuery (a single-element jQuery of container)


Performs a deep copy (clone) of its argument

  • tocopy {Object}: the object to be copied

Return: Object (the copy)

fluid.createDomBinder(container, selectors)

Creates a new DOM Binder instance, used to locate elements in the DOM by name.

  • container {Object}: The root element in which to locate named elements
  • selectors {Object}: A collection of named jQuery selectors

Return: Object

See: DOM Binder Guide and API


Retrieves and stores a component's default settings centrally.

  • {Boolean}: (optional) if true, manipulate a global option (for the head component) rather than instance options
  • {String}: componentName the name of the component
  • {Object}: (optional) a container of key/value pairs to set

Return: Object (If the object is passed in the argument, this is added to the store and then returned. If not, the current object in the store is returned)

See: DOM Binder Guide and API, Fluid Component API


Dumps a DOM element into a readily recognizable form for debugging - produces a "semi-selector" summarizing its tag name, class and id, whichever are set.

  • element {jQueryable}: can be an element, selector, function that returns an element, or a jQuery.

Return: String representing the DOM element


Construct a dummy or "placeholder" subcomponent, that optionally provides empty implementations for a set of methods.

  • options {Anything}: can be anything, will use jQuery.makeArray to turn it into an array

Return: Object (the empty sub-component)

fluid.event.getEventFirer(unicast, preventable)

Constructs an "event firer" object which can be used to register and unregister listeners, to which "events" can be fired. These events consist of an arbitrary function signature.

  • unicast {Boolean}: If true, this is a "unicast" event which may only accept a single listener.
  • preventable {Boolean}: If true, the return value of each handler will be checked for false in which case further listeners will be short circuited, and this will be the return value of fire().

Returns: Object (see below)

    addListener: function(listener, namespace, exclusions),
    removeListener: function(listener),
    fire: function()

See: The Fluid Event System









This function provides a generic way of instantiating and configuring any "sub-components" that may be a part of, or used by, a parent component. For example, this function is used by the Inline Edit component to instantiate the Undo decorator, a sub-component that provides Undo functionality to components that support it.


Parameter name





is a string defined by the invoking component, identifying an option understood by that component.





fluid.initView(componentName, container, userOptions)





See also: fluid.byId














See also: fluid.wrap




See also: fluid.unwrap

fluid.initComponents(that, className, args)



Cleanse the children of a DOM node by removing all <script> tags. This is necessary to prevent the possibility that these blocks are reevaluated if the node were reattached to the document.

  • element {Element}: the parent element to begin removing <script> tags from.


Used to indicate that the DOM node has been stripped of all <script> tags

Constant: "fluid-scripts-cleansed"

See also: fluid.dom.cleanseScripts


Returns the absolute position of a supplied DOM node in pixels. Implementation taken from quirksmode

  • element {Element}: the element whose location is returned

Return: [curleft, curtop]


Returns the element text from the supplied DOM node as a single String.

  • element {Element}: the element to return the text from

Return: String

fluid.dom.insertAfter(newChild, refChild)

Mockup of a missing DOM function

Inserts newChild as the next sibling of refChild.

  • newChild {Element}: the new element to insert
  • refChild {Element}: the element to insert newChild after

fluid.dom.isContainer(container, containee)

Checks if the specified container is actually the parent of containee.

  • container {Element}: the potential parent
  • conatainee {Element}: the child in question

Return: Boolean


Determine if a node should be ignored by the iterator functions.
It will return true if the node is a Text node that is all whitespace or a comment node.

  • node {Element}: representing the DOM1 Node interface

Return: Boolean


Determine whether a node's text content is entirely whitespace

  • node {Element}: a node implementing the CharacterData interface (i.e., a Text, Comment, or CDATASection node

Return: Boolean

fluid.dom.iterateDom(node, acceptor, allNodes)

Walks the DOM, applying the specified acceptor function to each element. There is a special case for the acceptor, allowing for quick deletion of elements and their children.

  • node {Element}: a node to start walking the DOM from
  • acceptor {Function}: the function to invoke with each DOM element. If the return value is "delete", the element in question will be deleted. If the return value is "stop" the iteration will be terminated
  • allNodes {Boolean}: use true to call acceptor on all nodes, rather than just element nodes (type 1)


This is provided as a work around for IE's circular DOM issue. This is the default max DOM depth in IE.

Constant: 256


Each Fluid component includes a standard options structure at its top-level. Options allow implementors to configure and customize a component. User-supplied options are merged with relevant defaults for the given components. These defaults registered by each component with the Fluid defaults management system via a call to fluid.defaults():

fluid.default(componentName, defaultsObject);


  • componentName is a string name for the component, and
  • defaultsObject is a Javascript object containing key/value pairs for the default configuration of the component.

The options for each component (and their defaults) will vary, but all components share a subset of required defaults. These are:


The selectors <something?> is a Javascript object that defines the necessary selector strings that will be used to access the various DOM elements that make up the component. Each component will have different selectors, but all components must have this selectors. Implementors can override the default selectors, so long as the selectors they provide meet the following requirements:

  • selectors must be relative to the main component container element

fluid.applySkin(skin, element)

  • No labels