UNPKG

js-web-tools

Version:
45 lines (32 loc) 805 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.width = width; exports.height = height; var _domUtils = require("./domUtils"); var _domElementPosition = require("./domElementPosition"); function width(node, client) { var win = (0, _domUtils.isWindow)(node); /* istanbul ignore if */ if (win) { return win.innerWidth; } /* istanbul ignore if */ if (client) { return client.clientWidth; } return (0, _domElementPosition.getOffset)(node).width; } function height(node, client) { var win = (0, _domUtils.isWindow)(node); /* istanbul ignore if */ if (win) { return win.innerHeight; } /* istanbul ignore if */ if (client) { return client.clientHeight; } return (0, _domElementPosition.getOffset)(node).height; }