linkTarget property

String? linkTarget

contains the content of the "href" attribute, if present, null otherwise

Implementation

String? get linkTarget {
  NodeV2? k = this;

  while (k != null) {
    if (k.tagName == "a") {
      List<SimpleProperty> hrefs =
          k.properties.where((element) => element.name == "href").toList();

      if (hrefs.length > 0) {
        return hrefs.first.value;
      }

      return "";
    }

    k = k.parent;
  }

  return null;
}