dom-tools
Version:
A tiny collection of DOM helpers for IE8+.
17 lines (13 loc) • 449 B
JavaScript
var _getComputedStyle = require('./getComputedStyle');
// emulate $(el).height();
//
// Browser support: IE9+
//
// Modified snippet from http://stackoverflow.com/a/29881817
function height(/* Element */ el) {
var computedStyle = _getComputedStyle(el);
var height = el.clientHeight; // height with padding
height -= parseFloat(computedStyle.paddingTop) + parseFloat(computedStyle.paddingBottom);
return height;
}
module.exports = height;