MCPcopy
hub / github.com/reisxd/TizenTube / getBoundingClientRect

Function getBoundingClientRect

mods/spatial-navigation-polyfill.js:1556–1572  ·  view source on GitHub ↗

* Get the DOMRect of an element * @function getBoundingClientRect * @param {Node} element * @returns {DOMRect}

(element)

Source from the content-addressed store, hash-verified

1554 * @returns {DOMRect}
1555 */
1556 function getBoundingClientRect(element) {
1557 // memoization
1558 let rect = mapOfBoundRect && mapOfBoundRect.get(element);
1559 if (!rect) {
1560 const boundingClientRect = element.getBoundingClientRect();
1561 rect = {
1562 top: Number(boundingClientRect.top.toFixed(2)),
1563 right: Number(boundingClientRect.right.toFixed(2)),
1564 bottom: Number(boundingClientRect.bottom.toFixed(2)),
1565 left: Number(boundingClientRect.left.toFixed(2)),
1566 width: Number(boundingClientRect.width.toFixed(2)),
1567 height: Number(boundingClientRect.height.toFixed(2))
1568 };
1569 mapOfBoundRect && mapOfBoundRect.set(element, rect);
1570 }
1571 return rect;
1572 }
1573
1574 /**
1575 * Get the candidates which is fully inside the target element in visual

Callers 8

filteredCandidatesFunction · 0.85
selectBestCandidateFunction · 0.85
getClosestElementFunction · 0.85
findSearchOriginFunction · 0.85
isVisibleInScrollerFunction · 0.85
isEntirelyVisibleFunction · 0.85
hitTestFunction · 0.85
getExperimentalAPIFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected