dom-tools
Version:
A tiny collection of DOM helpers for IE8+.
17 lines (14 loc) • 495 B
JavaScript
var _getComputedStyle = require('./getComputedStyle');
// IE8+
//
// "$.outerHeight()" http://youmightnotneedjquery.com/#outer_height
// "$.outerHeight(true)" http://youmightnotneedjquery.com/#outer_height_with_margin
function outerHeight(/* Element */ el, withMargin) {
var height = el.offsetHeight;
if (withMargin) {
var style = _getComputedStyle(el);
height += parseInt(style.marginTop) + parseInt(style.marginBottom);
}
return height;
}
module.exports = outerHeight;