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

Function getBoundingClientRect

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

* Get bounding client rect of given element * @method * @memberof Popper.Utils * @param {HTMLElement} element * @return {Object} client rect

(element)

Source from the content-addressed store, hash-verified

3416
3417
3418function getBoundingClientRect(element) {
3419 var rect = {}; // IE10 10 FIX: Please, don't ask, the element isn't
3420 // considered in DOM in some circumstances...
3421 // This isn't reproducible in IE10 compatibility mode of IE11
3422
3423 try {
3424 if (isIE(10)) {
3425 rect = element.getBoundingClientRect();
3426 var scrollTop = getScroll(element, 'top');
3427 var scrollLeft = getScroll(element, 'left');
3428 rect.top += scrollTop;
3429 rect.left += scrollLeft;
3430 rect.bottom += scrollTop;
3431 rect.right += scrollLeft;
3432 } else {
3433 rect = element.getBoundingClientRect();
3434 }
3435 } catch (e) {}
3436
3437 var result = {
3438 left: rect.left,
3439 top: rect.top,
3440 width: rect.right - rect.left,
3441 height: rect.bottom - rect.top
3442 }; // subtract scrollbar size from sizes
3443
3444 var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {};
3445 var width = sizes.width || element.clientWidth || result.right - result.left;
3446 var height = sizes.height || element.clientHeight || result.bottom - result.top;
3447 var horizScrollbar = element.offsetWidth - width;
3448 var vertScrollbar = element.offsetHeight - height; // if an hypothetical scrollbar is detected, we must be sure it's not a `border`
3449 // we make this check conditional for performance reasons
3450
3451 if (horizScrollbar || vertScrollbar) {
3452 var styles = getStyleComputedProperty(element);
3453 horizScrollbar -= getBordersSize(styles, 'x');
3454 vertScrollbar -= getBordersSize(styles, 'y');
3455 result.width -= horizScrollbar;
3456 result.height -= vertScrollbar;
3457 }
3458
3459 return getClientRect(result);
3460}
3461
3462function getOffsetRectRelativeToArbitraryNode(children, parent) {
3463 var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;

Callers 2

computeStyleFunction · 0.85

Calls 6

isIEFunction · 0.85
getScrollFunction · 0.85
getWindowSizesFunction · 0.85
getStyleComputedPropertyFunction · 0.85
getBordersSizeFunction · 0.85
getClientRectFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…