main
Last change
on this file was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 2 weeks ago |
F4 Finalna Verzija
|
-
Property mode
set to
100644
|
File size:
564 bytes
|
Line | |
---|
1 | // @flow
|
---|
2 | import getParentNode from './getParentNode';
|
---|
3 | import isScrollParent from './isScrollParent';
|
---|
4 | import getNodeName from './getNodeName';
|
---|
5 | import { isHTMLElement } from './instanceOf';
|
---|
6 |
|
---|
7 | export default function getScrollParent(node: Node): HTMLElement {
|
---|
8 | if (['html', 'body', '#document'].indexOf(getNodeName(node)) >= 0) {
|
---|
9 | // $FlowFixMe[incompatible-return]: assume body is always available
|
---|
10 | return node.ownerDocument.body;
|
---|
11 | }
|
---|
12 |
|
---|
13 | if (isHTMLElement(node) && isScrollParent(node)) {
|
---|
14 | return node;
|
---|
15 | }
|
---|
16 |
|
---|
17 | return getScrollParent(getParentNode(node));
|
---|
18 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.