getElementHeight function

int? getElementHeight(
  1. Element element, [
  2. int? def
])

Returns element height. Tries to use 'offsetHeight' or 'style.height' values.

def default value if width is null or 0.

Implementation

int? getElementHeight(Element element, [int? def]) {
  var h = element.offsetHeight;
  if (h <= 0) {
    h = parseCSSLength(element.style.height, unit: 'px', def: def ?? 0) as int;
  }
  return h <= 0 ? def : h;
}