setElementValue function

bool setElementValue(
  1. Element? element,
  2. String value
)

Sets the element value depending of the identified type.

Implementation

bool setElementValue(Element? element, String value) {
  if (element == null) return false;

  if (element is InputElement) {
    element.value = value;
    return true;
  } else if (element is CanvasImageSource) {
    return setElementSRC(element, value);
  } else if (element is CheckboxInputElement) {
    element.checked = parseBool(value);
    return true;
  } else if (element is TextAreaElement) {
    element.value = value;
    return true;
  } else if (isElementWithSRC(element)) {
    return setElementSRC(element, value);
  } else if (isElementWithHREF(element)) {
    return setElementHREF(element, value);
  } else {
    element.text = value;
    return true;
  }
}