getElementValue function

String? getElementValue(
  1. Element element, [
  2. String? def
])

Gets the element value depending of identified type.

If the resolved value is null or empty, and def is not null, it will return def.

Implementation

String? getElementValue(Element element, [String? def]) {
  String? value;

  if (element.isA<HTMLInputElement>()) {
    value = (element as HTMLInputElement).value;
  } else {
    value = getElementSRC(element);
  }

  return def != null && isEmptyObject(value) ? def : value;
}