MCPcopy Index your code
hub / github.com/shipshapecode/tether / getBounds

Function getBounds

src/js/utils/bounds.js:8–39  ·  view source on GitHub ↗
(body, el)

Source from the content-addressed store, hash-verified

6let zeroElement = null;
7
8export function getBounds(body, el) {
9 let doc;
10 if (el === document) {
11 doc = document;
12 el = document.documentElement;
13 } else {
14 doc = el.ownerDocument;
15 }
16
17 const docEl = doc.documentElement;
18
19 const box = _getActualBoundingClientRect(el);
20
21 const origin = _getOrigin(body);
22
23 box.top -= origin.top;
24 box.left -= origin.left;
25
26 if (isUndefined(box.width)) {
27 box.width = document.body.scrollWidth - box.left - box.right;
28 }
29 if (isUndefined(box.height)) {
30 box.height = document.body.scrollHeight - box.top - box.bottom;
31 }
32
33 box.top = box.top - docEl.clientTop;
34 box.left = box.left - docEl.clientLeft;
35 box.right = doc.body.clientWidth - box.width - box.left;
36 box.bottom = doc.body.clientHeight - box.height - box.top;
37
38 return box;
39}
40
41/**
42 * Gets bounds for when target modifiier is 'scroll-handle'

Callers 8

bounds.spec.jsFile · 0.90
getBoundingRectFunction · 0.90
positionFunction · 0.90
positionFunction · 0.90
getTargetBoundsMethod · 0.90
positionMethod · 0.90
getScrollHandleBoundsFunction · 0.85
getVisibleBoundsFunction · 0.85

Calls 3

isUndefinedFunction · 0.90
_getOriginFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…