Finds the nearest ancestor of the element that passes the test.
Code Block
javascript
javascript
bgColor
white
borderStyle
none
fluid.findAncestor(element, test);
File name:Fluid.js
Parameters
Span
class
borderless-table
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
Span
class
borderless-table
Element
the nearest ancestor that passes the test
Column
width
5%
Column
See Also
Example
Code Block
javascript
javascript
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.