about summary refs log tree commit diff stats
path: root/src/buffer/buffer.nim
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-01-02 21:19:46 +0100
committerbptato <nincsnevem662@gmail.com>2023-01-02 21:19:46 +0100
commit62983cdc609aacc47ade0a8a4a4c6b85dd26199a (patch)
treeab0518ac0f556a499107887fb524beddb80ba104 /src/buffer/buffer.nim
parentf2bf1572456412f109d06c6a49e34cfbe924bbfa (diff)
downloadchawan-62983cdc609aacc47ade0a8a4a4c6b85dd26199a.tar.gz
dom: add better attribute reflection
Instead of creating a new function for each attribute, use a single
magic function for reflected attributes.
Diffstat (limited to 'src/buffer/buffer.nim')
-rw-r--r--src/buffer/buffer.nim5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/buffer/buffer.nim b/src/buffer/buffer.nim
index f7ad6537..34674062 100644
--- a/src/buffer/buffer.nim
+++ b/src/buffer/buffer.nim
@@ -512,8 +512,9 @@ proc updateHover*(buffer: Buffer, cursorx, cursory: int): UpdateHoverResult {.pr
   buffer.prevnode = thisnode
 
 proc loadResource(buffer: Buffer, document: Document, elem: HTMLLinkElement) =
-  if elem.href == "": return
-  let url = parseURL(elem.href, document.url.some)
+  let href = elem.attr("href")
+  if href == "": return
+  let url = parseURL(href, document.url.some)
   if url.isSome:
     let url = url.get
     if url.scheme == buffer.url.scheme: