Documentation for a historical release of Infusion: 1.4
Please view the Infusion Documentation site for the latest documentation, or the Infusion 1.3. Documentation for the previous release.
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

fluid.findAncestor(element, test)

Finds the nearest ancestor of the element that passes the test.

fluid.findAncestor(element, test);

File name: Fluid.js


element (Element) DOM element
test (Function) A function which takes an element as a parameter and returns true or false for some test.

Return Value

Element the nearest ancestor that passes the test

See Also


var smallHeader = fluid.jById(id);
var bigHeader = fluid.findAncestor(smallHeader, function (element) {
    return $(element).is(selectors.sortHeader);

In this example, fluid.findAncestor() is used to find an ancestor of smallHeader that has a desired selector.

  • No labels