This documentation is currently being moved to our new documentation site.

Please view or edit the documentation there, instead.

If you're looking for Fluid Project coordination, design, communication, etc, try the Fluid Project Wiki.


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.