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:
546 bytes
|
Line | |
---|
1 | import getParentNode from "./getParentNode.js";
|
---|
2 | import isScrollParent from "./isScrollParent.js";
|
---|
3 | import getNodeName from "./getNodeName.js";
|
---|
4 | import { isHTMLElement } from "./instanceOf.js";
|
---|
5 | export default function getScrollParent(node) {
|
---|
6 | if (['html', 'body', '#document'].indexOf(getNodeName(node)) >= 0) {
|
---|
7 | // $FlowFixMe[incompatible-return]: assume body is always available
|
---|
8 | return node.ownerDocument.body;
|
---|
9 | }
|
---|
10 |
|
---|
11 | if (isHTMLElement(node) && isScrollParent(node)) {
|
---|
12 | return node;
|
---|
13 | }
|
---|
14 |
|
---|
15 | return getScrollParent(getParentNode(node));
|
---|
16 | } |
---|
Note:
See
TracBrowser
for help on using the repository browser.