PageSourceSearch

https://www.astrobetter.com/wiki/public/generated/js/vendor_dist/@…/esm/dom-utils/getBoundingClientRect.js

js astrobetter.com collected 2026-10-02 03:39:21 UTC 1,371 bytes, 41 lines download raw bytes

vendor: 1,371 bytes, lines 1-41
1import { isElement, isHTMLElement } from "./instanceOf.js";
2import { round } from "../utils/math.js";
3import getWindow from "./getWindow.js";
4import isLayoutViewport from "./isLayoutViewport.js";
5export default function getBoundingClientRect(element, includeScale, isFixedStrategy) {
6  if (includeScale === void 0) {
7    includeScale = false;
8  }
9
10  if (isFixedStrategy === void 0) {
11    isFixedStrategy = false;
12  }
13
14  var clientRect = element.getBoundingClientRect();
15  var scaleX = 1;
16  var scaleY = 1;
17
18  if (includeScale && isHTMLElement(element)) {
19    scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
20    scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
21  }
22
23  var _ref = isElement(element) ? getWindow(element) : window,
24      visualViewport = _ref.visualViewport;
25
26  var addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
27  var x = (clientRect.left + (addVisualOffsets && visualViewport ? visualViewport.offsetLeft : 0)) / scaleX;
28  var y = (clientRect.top + (addVisualOffsets && visualViewport ? visualViewport.offsetTop : 0)) / scaleY;
29  var width = clientRect.width / scaleX;
30  var height = clientRect.height / scaleY;
31  return {
32    width: width,
33    height: height,
34    top: y,
35    right: x + width,
36    bottom: y + height,
37    left: x,
38    x: x,
39    y: y
40  };
41}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.