source: imaps-frontend/node_modules/@popperjs/core/lib/dom-utils/getParentNode.js

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: 759 bytes
Line 
1import getNodeName from "./getNodeName.js";
2import getDocumentElement from "./getDocumentElement.js";
3import { isShadowRoot } from "./instanceOf.js";
4export default function getParentNode(element) {
5 if (getNodeName(element) === 'html') {
6 return element;
7 }
8
9 return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle
10 // $FlowFixMe[incompatible-return]
11 // $FlowFixMe[prop-missing]
12 element.assignedSlot || // step into the shadow DOM of the parent of a slotted node
13 element.parentNode || ( // DOM Element detected
14 isShadowRoot(element) ? element.host : null) || // ShadowRoot detected
15 // $FlowFixMe[incompatible-call]: HTMLElement is a Node
16 getDocumentElement(element) // fallback
17
18 );
19}
Note: See TracBrowser for help on using the repository browser.