diff --git a/lib/src/interactable_element.dart b/lib/src/interactable_element.dart index 504f185406..2aab878a64 100644 --- a/lib/src/interactable_element.dart +++ b/lib/src/interactable_element.dart @@ -22,20 +22,30 @@ enum Gesture { TAP, } -InteractableElement parseInteractableElement( +StyledElement parseInteractableElement( dom.Element element, List children) { switch (element.localName) { case "a": - return InteractableElement( + if (element.attributes.containsKey('href')) { + return InteractableElement( + name: element.localName!, + children: children, + href: element.attributes['href'], + style: Style( + color: Colors.blue, + textDecoration: TextDecoration.underline, + ), + node: element, + elementId: element.id + ); + } + // When tag have no href, it must be non clickable and without decoration. + return StyledElement( name: element.localName!, children: children, - href: element.attributes['href'], - style: Style( - color: Colors.blue, - textDecoration: TextDecoration.underline, - ), + style: Style(), node: element, - elementId: element.id + elementId: element.id, ); /// will never be called, just to suppress missing return warning default: @@ -48,4 +58,4 @@ InteractableElement parseInteractableElement( elementId: "[[No ID]]" ); } -} \ No newline at end of file +}