MCPcopy Index your code
hub / github.com/docker/getting-started / getBoundaries

Function getBoundaries

app/src/static/js/react-bootstrap.js:3590–3642  ·  view source on GitHub ↗

* Computed the boundaries limits and return them * @method * @memberof Popper.Utils * @param {HTMLElement} popper * @param {HTMLElement} reference * @param {number} padding * @param {HTMLElement} boundariesElement - Element used to define the boundaries * @param {Boolean} fixedPosition - Is i

(popper, reference, padding, boundariesElement)

Source from the content-addressed store, hash-verified

3588
3589
3590function getBoundaries(popper, reference, padding, boundariesElement) {
3591 var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false; // NOTE: 1 DOM access here
3592
3593 var boundaries = {
3594 top: 0,
3595 left: 0
3596 };
3597 var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, reference); // Handle viewport case
3598
3599 if (boundariesElement === 'viewport') {
3600 boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition);
3601 } else {
3602 // Handle other cases based on DOM element used as boundaries
3603 var boundariesNode = void 0;
3604
3605 if (boundariesElement === 'scrollParent') {
3606 boundariesNode = getScrollParent(getParentNode(reference));
3607
3608 if (boundariesNode.nodeName === 'BODY') {
3609 boundariesNode = popper.ownerDocument.documentElement;
3610 }
3611 } else if (boundariesElement === 'window') {
3612 boundariesNode = popper.ownerDocument.documentElement;
3613 } else {
3614 boundariesNode = boundariesElement;
3615 }
3616
3617 var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition); // In case of HTML, we need a different computation
3618
3619 if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) {
3620 var _getWindowSizes = getWindowSizes(popper.ownerDocument),
3621 height = _getWindowSizes.height,
3622 width = _getWindowSizes.width;
3623
3624 boundaries.top += offsets.top - offsets.marginTop;
3625 boundaries.bottom = height + offsets.top;
3626 boundaries.left += offsets.left - offsets.marginLeft;
3627 boundaries.right = width + offsets.left;
3628 } else {
3629 // for all the other DOM elements, this one is good
3630 boundaries = offsets;
3631 }
3632 } // Add paddings
3633
3634
3635 padding = padding || 0;
3636 var isPaddingNumber = typeof padding === 'number';
3637 boundaries.left += isPaddingNumber ? padding : padding.left || 0;
3638 boundaries.top += isPaddingNumber ? padding : padding.top || 0;
3639 boundaries.right -= isPaddingNumber ? padding : padding.right || 0;
3640 boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0;
3641 return boundaries;
3642}
3643
3644function getArea(_ref) {
3645 var width = _ref.width,

Callers 3

computeAutoPlacementFunction · 0.85
flipFunction · 0.85
preventOverflowFunction · 0.85

Calls 8

findCommonOffsetParentFunction · 0.85
getScrollParentFunction · 0.85
getParentNodeFunction · 0.85
isFixedFunction · 0.85
getWindowSizesFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…