diff options
author | bptato <nincsnevem662@gmail.com> | 2024-02-15 20:38:01 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2024-02-15 20:40:17 +0100 |
commit | 65e734f23f9e3259f679f8852e77e90002281d40 (patch) | |
tree | 9a5f6e9f46df0627eb5e3f3df56575e8d6ea14d9 /src/html | |
parent | 7b21ebe964887c27efad2bb64f160ba8ce8023cd (diff) | |
download | chawan-65e734f23f9e3259f679f8852e77e90002281d40.tar.gz |
dom: fix href stringifier
Return the empty string if it's unset.
Diffstat (limited to 'src/html')
-rw-r--r-- | src/html/dom.nim | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/html/dom.nim b/src/html/dom.nim index 622331a2..d5b21622 100644 --- a/src/html/dom.nim +++ b/src/html/dom.nim @@ -2306,6 +2306,8 @@ func target0*(element: Element): string = # HTMLHyperlinkElementUtils (for <a> and <area>) func href0[T: HTMLAnchorElement|HTMLAreaElement](element: T): string = + if not element.attrb(atHref): + return "" let url = parseURL(element.attr(atHref), some(element.document.baseURL)) if url.isSome: return $url.get |