Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugo-mod-jslibs-dist.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'popperjs/package/lib/dom-utils/getDocumentRect.js')
-rw-r--r--popperjs/package/lib/dom-utils/getDocumentRect.js29
1 files changed, 29 insertions, 0 deletions
diff --git a/popperjs/package/lib/dom-utils/getDocumentRect.js b/popperjs/package/lib/dom-utils/getDocumentRect.js
new file mode 100644
index 0000000..d24df8e
--- /dev/null
+++ b/popperjs/package/lib/dom-utils/getDocumentRect.js
@@ -0,0 +1,29 @@
+import getDocumentElement from "./getDocumentElement.js";
+import getComputedStyle from "./getComputedStyle.js";
+import getWindowScrollBarX from "./getWindowScrollBarX.js";
+import getWindowScroll from "./getWindowScroll.js";
+import { max } from "../utils/math.js"; // Gets the entire size of the scrollable document area, even extending outside
+// of the `<html>` and `<body>` rect bounds if horizontally scrollable
+
+export default function getDocumentRect(element) {
+ var _element$ownerDocumen;
+
+ var html = getDocumentElement(element);
+ var winScroll = getWindowScroll(element);
+ var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
+ var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
+ var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
+ var x = -winScroll.scrollLeft + getWindowScrollBarX(element);
+ var y = -winScroll.scrollTop;
+
+ if (getComputedStyle(body || html).direction === 'rtl') {
+ x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
+ }
+
+ return {
+ width: width,
+ height: height,
+ x: x,
+ y: y
+ };
+} \ No newline at end of file