PHP 8.2.30
Preview: getOffsetParent.js Size: 2.55 KB
/proc/thread-self/root/home/byroehnu/.trash/node_modules11/@popperjs/core/lib/dom-utils/getOffsetParent.js

import getWindow from "./getWindow.js";
import getNodeName from "./getNodeName.js";
import getComputedStyle from "./getComputedStyle.js";
import { isHTMLElement, isShadowRoot } from "./instanceOf.js";
import isTableElement from "./isTableElement.js";
import getParentNode from "./getParentNode.js";
import getUAString from "../utils/userAgent.js";

function getTrueOffsetParent(element) {
  if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837
  getComputedStyle(element).position === 'fixed') {
    return null;
  }

  return element.offsetParent;
} // `.offsetParent` reports `null` for fixed elements, while absolute elements
// return the containing block


function getContainingBlock(element) {
  var isFirefox = /firefox/i.test(getUAString());
  var isIE = /Trident/i.test(getUAString());

  if (isIE && isHTMLElement(element)) {
    // In IE 9, 10 and 11 fixed elements containing block is always established by the viewport
    var elementCss = getComputedStyle(element);

    if (elementCss.position === 'fixed') {
      return null;
    }
  }

  var currentNode = getParentNode(element);

  if (isShadowRoot(currentNode)) {
    currentNode = currentNode.host;
  }

  while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) {
    var css = getComputedStyle(currentNode); // This is non-exhaustive but covers the most common CSS properties that
    // create a containing block.
    // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block

    if (css.transform !== 'none' || css.perspective !== 'none' || css.contain === 'paint' || ['transform', 'perspective'].indexOf(css.willChange) !== -1 || isFirefox && css.willChange === 'filter' || isFirefox && css.filter && css.filter !== 'none') {
      return currentNode;
    } else {
      currentNode = currentNode.parentNode;
    }
  }

  return null;
} // Gets the closest ancestor positioned element. Handles some edge cases,
// such as table ancestors and cross browser bugs.


export default function getOffsetParent(element) {
  var window = getWindow(element);
  var offsetParent = getTrueOffsetParent(element);

  while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === 'static') {
    offsetParent = getTrueOffsetParent(offsetParent);
  }

  if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static')) {
    return window;
  }

  return offsetParent || getContainingBlock(element) || window;
}

Directory Contents

Dirs: 0 × Files: 69

Name Size Perms Modified Actions
76 B lrw-r--r-- 2026-02-28 00:29:44
Edit Download
677 B lrw-r--r-- 2026-02-28 00:29:44
Edit Download
697 B lrw-r--r-- 2026-02-28 00:29:46
Edit Download
217 B lrw-r--r-- 2026-02-28 00:29:48
Edit Download
1.34 KB lrw-r--r-- 2026-02-28 00:29:48
Edit Download
1.45 KB lrw-r--r-- 2026-02-28 00:29:48
Edit Download
283 B lrw-r--r-- 2026-02-28 00:29:50
Edit Download
3.32 KB lrw-r--r-- 2026-02-28 00:29:50
Edit Download
3.69 KB lrw-r--r-- 2026-02-28 00:29:52
Edit Download
212 B lrw-r--r-- 2026-02-28 00:29:52
Edit Download
2.02 KB lrw-r--r-- 2026-02-28 00:29:54
Edit Download
2.14 KB lrw-r--r-- 2026-02-28 00:29:54
Edit Download
81 B lrw-r--r-- 2026-02-28 00:29:56
Edit Download
148 B lrw-r--r-- 2026-02-28 00:29:56
Edit Download
190 B lrw-r--r-- 2026-02-28 00:29:58
Edit Download
124 B lrw-r--r-- 2026-02-28 00:29:58
Edit Download
311 B lrw-r--r-- 2026-02-28 00:29:58
Edit Download
420 B lrw-r--r-- 2026-02-28 00:29:58
Edit Download
107 B lrw-r--r-- 2026-02-28 00:29:58
Edit Download
1.20 KB lrw-r--r-- 2026-02-28 00:29:58
Edit Download
1.17 KB lrw-r--r-- 2026-02-28 00:29:58
Edit Download
120 B lrw-r--r-- 2026-02-28 00:29:58
Edit Download
142 B lrw-r--r-- 2026-02-28 00:29:58
Edit Download
167 B lrw-r--r-- 2026-02-28 00:30:00
Edit Download
105 B lrw-r--r-- 2026-02-28 00:30:00
Edit Download
767 B lrw-r--r-- 2026-02-28 00:30:02
Edit Download
821 B lrw-r--r-- 2026-02-28 00:30:02
Edit Download
149 B lrw-r--r-- 2026-02-28 00:30:02
Edit Download
114 B lrw-r--r-- 2026-02-28 00:30:04
Edit Download
190 B lrw-r--r-- 2026-02-28 00:30:04
Edit Download
146 B lrw-r--r-- 2026-02-28 00:30:06
Edit Download
396 B lrw-r--r-- 2026-02-28 00:30:06
Edit Download
450 B lrw-r--r-- 2026-02-28 00:30:06
Edit Download
64 B lrw-r--r-- 2026-02-28 00:30:06
Edit Download
2.55 KB lrw-r--r-- 2026-02-28 00:30:06
Edit Download
2.70 KB lrw-r--r-- 2026-02-28 00:30:06
Edit Download
73 B lrw-r--r-- 2026-02-28 00:30:06
Edit Download
759 B lrw-r--r-- 2026-02-28 00:30:08
Edit Download
789 B lrw-r--r-- 2026-02-28 00:30:08
Edit Download
66 B lrw-r--r-- 2026-02-28 00:30:08
Edit Download
546 B lrw-r--r-- 2026-02-28 00:30:08
Edit Download
564 B lrw-r--r-- 2026-02-28 00:30:08
Edit Download
217 B lrw-r--r-- 2026-02-28 00:30:08
Edit Download
881 B lrw-r--r-- 2026-02-28 00:30:10
Edit Download
964 B lrw-r--r-- 2026-02-28 00:30:10
Edit Download
51 B lrw-r--r-- 2026-02-28 00:30:10
Edit Download
273 B lrw-r--r-- 2026-02-28 00:30:10
Edit Download
383 B lrw-r--r-- 2026-02-28 00:30:12
Edit Download
148 B lrw-r--r-- 2026-02-28 00:30:12
Edit Download
258 B lrw-r--r-- 2026-02-28 00:30:12
Edit Download
306 B lrw-r--r-- 2026-02-28 00:30:12
Edit Download
71 B lrw-r--r-- 2026-02-28 00:30:12
Edit Download
721 B lrw-r--r-- 2026-02-28 00:30:14
Edit Download
754 B lrw-r--r-- 2026-02-28 00:30:14
Edit Download
214 B lrw-r--r-- 2026-02-28 00:30:14
Edit Download
621 B lrw-r--r-- 2026-02-28 00:30:14
Edit Download
902 B lrw-r--r-- 2026-02-28 00:30:14
Edit Download
53 B lrw-r--r-- 2026-02-28 00:30:16
Edit Download
159 B lrw-r--r-- 2026-02-28 00:30:16
Edit Download
167 B lrw-r--r-- 2026-02-28 00:30:16
Edit Download
71 B lrw-r--r-- 2026-02-28 00:30:16
Edit Download
440 B lrw-r--r-- 2026-02-28 00:30:18
Edit Download
349 B lrw-r--r-- 2026-02-28 00:30:18
Edit Download
67 B lrw-r--r-- 2026-02-28 00:30:20
Edit Download
162 B lrw-r--r-- 2026-02-28 00:30:20
Edit Download
188 B lrw-r--r-- 2026-02-28 00:30:22
Edit Download
188 B lrw-r--r-- 2026-02-28 00:30:22
Edit Download
1.15 KB lrw-r--r-- 2026-02-28 00:30:22
Edit Download
1.20 KB lrw-r--r-- 2026-02-28 00:30:24
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).