Skip to end of metadata
Go to start of metadata
Table of Contents

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