just.getRemoteParent(childNode, fn, rootContaineropt, includeChildopt) → {Node|null}
Goes up through the childNode parents, until fn returns `true`
or a non-Node is found.
Parameters:
Name
Type
Default
Description
childNode
Node
Some child.
fn
just.getRemoteParent~fn
Some custom handler.
rootContainer
[optional]
Node
html
The farthest parent.
includeChild
[optional]
boolean
false
If `true`, it calls fn with childNode too.
Returns:
The current Node when fn returns `true`.
-
Type
-
Node
or
null
Example
Name | Type | Default | Description |
---|---|---|---|
childNode
|
Node | Some child. | |
fn
|
just.getRemoteParent~fn | Some custom handler. | |
rootContainer
[optional] |
Node | html | The farthest parent. |
includeChild
[optional] |
boolean | false | If `true`, it calls fn with childNode too. |
just.getRemoteParent(just.body, function () {
return this.tagName === 'HTML';
}); // returns the <html> Element.
Type Definitions
fn(deepLevelnon-null, rootContainer) → {boolean}
A function that checks if this is the Node that you're looking for.
This:
Node
Parameters:
Name | Type | Description |
---|---|---|
deepLevel
|
Number | A counter that indicates how many elements have checked. |
rootContainer
|
Node | The root container. |
Returns:
- Type
- boolean