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

Function getBoundingClientRect

web/static/js/bootstrap.bundle.js:1936–1983  ·  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

1934 * @return {Object} client rect
1935 */
1936 function getBoundingClientRect(element) {
1937 var rect = {};
1938
1939 // IE10 10 FIX: Please, don't ask, the element isn't
1940 // considered in DOM in some circumstances...
1941 // This isn't reproducible in IE10 compatibility mode of IE11
1942 try {
1943 if (isIE(10)) {
1944 rect = element.getBoundingClientRect();
1945 var scrollTop = getScroll(element, 'top');
1946 var scrollLeft = getScroll(element, 'left');
1947 rect.top += scrollTop;
1948 rect.left += scrollLeft;
1949 rect.bottom += scrollTop;
1950 rect.right += scrollLeft;
1951 } else {
1952 rect = element.getBoundingClientRect();
1953 }
1954 } catch (e) {}
1955
1956 var result = {
1957 left: rect.left,
1958 top: rect.top,
1959 width: rect.right - rect.left,
1960 height: rect.bottom - rect.top
1961 };
1962
1963 // subtract scrollbar size from sizes
1964 var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {};
1965 var width = sizes.width || element.clientWidth || result.right - result.left;
1966 var height = sizes.height || element.clientHeight || result.bottom - result.top;
1967
1968 var horizScrollbar = element.offsetWidth - width;
1969 var vertScrollbar = element.offsetHeight - height;
1970
1971 // if an hypothetical scrollbar is detected, we must be sure it's not a `border`
1972 // we make this check conditional for performance reasons
1973 if (horizScrollbar || vertScrollbar) {
1974 var styles = getStyleComputedProperty(element);
1975 horizScrollbar -= getBordersSize(styles, 'x');
1976 vertScrollbar -= getBordersSize(styles, 'y');
1977
1978 result.width -= horizScrollbar;
1979 result.height -= vertScrollbar;
1980 }
1981
1982 return getClientRect(result);
1983 }
1984
1985 function getOffsetRectRelativeToArbitraryNode(children, parent) {
1986 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