setElementHREF function

bool setElementHREF(
  1. Element element,
  2. String href
)

Sets element href depending of the identified type.

Implementation

bool setElementHREF(Element element, String href) {
  if (element is LinkElement) {
    element.href = href;
    return true;
  } else if (element is AnchorElement) {
    // ignore: unsafe_html
    element.href = href;
    return true;
  } else if (element is BaseElement) {
    element.href = href;
    return true;
  } else if (element is AreaElement) {
    element.href = href;
    return true;
  }

  return false;
}