MCPcopy
hub / github.com/deepch/RTSPtoWebRTC / getOffsetParent

Function getOffsetParent

web/static/js/bootstrap.bundle.js:1684–1711  ·  view source on GitHub ↗

* Returns the offset parent of the given element * @method * @memberof Popper.Utils * @argument {Element} element * @returns {Element} offset parent

(element)

Source from the content-addressed store, hash-verified

1682 * @returns {Element} offset parent
1683 */
1684 function getOffsetParent(element) {
1685 if (!element) {
1686 return document.documentElement;
1687 }
1688
1689 var noOffsetParent = isIE(10) ? document.body : null;
1690
1691 // NOTE: 1 DOM access here
1692 var offsetParent = element.offsetParent || null;
1693 // Skip hidden elements which don't have an offsetParent
1694 while (offsetParent === noOffsetParent && element.nextElementSibling) {
1695 offsetParent = (element = element.nextElementSibling).offsetParent;
1696 }
1697
1698 var nodeName = offsetParent && offsetParent.nodeName;
1699
1700 if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {
1701 return element ? element.ownerDocument.documentElement : document.documentElement;
1702 }
1703
1704 // .offsetParent will return the closest TH, TD or TABLE in case
1705 // no offsetParent is present, I hate this job...
1706 if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') {
1707 return getOffsetParent(offsetParent);
1708 }
1709
1710 return offsetParent;
1711 }
1712
1713 function isOffsetContainer(element) {
1714 var nodeName = element.nodeName;

Callers 4

isOffsetContainerFunction · 0.85
findCommonOffsetParentFunction · 0.85
computeStyleFunction · 0.85
preventOverflowFunction · 0.85

Calls 2

isIEFunction · 0.85
getStyleComputedPropertyFunction · 0.85

Tested by

no test coverage detected