Skip to content

Commit

Permalink
fix: Get elements ownerDocument for correct measurements (#607)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanseddon authored and FezVrasta committed Apr 11, 2018
1 parent 109ebd1 commit a906323
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/popper/src/utils/getBoundaries.js
Expand Up @@ -57,7 +57,7 @@ export default function getBoundaries(

// In case of HTML, we need a different computation
if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) {
const { height, width } = getWindowSizes();
const { height, width } = getWindowSizes(popper.ownerDocument);
boundaries.top += offsets.top - offsets.marginTop;
boundaries.bottom = height + offsets.top;
boundaries.left += offsets.left - offsets.marginLeft;
Expand Down
2 changes: 1 addition & 1 deletion packages/popper/src/utils/getBoundingClientRect.js
Expand Up @@ -42,7 +42,7 @@ export default function getBoundingClientRect(element) {
};

// subtract scrollbar size from sizes
const sizes = element.nodeName === 'HTML' ? getWindowSizes() : {};
const sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {};
const width =
sizes.width || element.clientWidth || result.right - result.left;
const height =
Expand Down
2 changes: 1 addition & 1 deletion packages/popper/src/utils/getOffsetRect.js
Expand Up @@ -11,7 +11,7 @@ import getClientRect from './getClientRect';
export default function getOffsetRect(element) {
let elementRect;
if (element.nodeName === 'HTML') {
const { width, height } = getWindowSizes();
const { width, height } = getWindowSizes(element.ownerDocument);
elementRect = {
width,
height,
Expand Down
2 changes: 1 addition & 1 deletion packages/popper/src/utils/getWindowSizes.js
Expand Up @@ -15,7 +15,7 @@ function getSize(axis, body, html, computedStyle) {
);
}

export default function getWindowSizes() {
export default function getWindowSizes(document) {
const body = document.body;
const html = document.documentElement;
const computedStyle = isIE(10) && getComputedStyle(html);
Expand Down

0 comments on commit a906323

Please sign in to comment.