about summary refs log tree commit diff stats
path: root/src/html
diff options
context:
space:
mode:
Diffstat (limited to 'src/html')
-rw-r--r--src/html/dom.nim9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/html/dom.nim b/src/html/dom.nim
index 11254c56..c0dc066c 100644
--- a/src/html/dom.nim
+++ b/src/html/dom.nim
@@ -27,10 +27,10 @@ import js/timeout
 import types/blob
 import types/color
 import types/matrix
-import types/mime
 import types/referer
 import types/url
 import types/vector
+import utils/mimeguess
 import utils/twtstr
 
 type
@@ -794,6 +794,7 @@ const ReflectTable0 = [
 # Forward declarations
 func attrb*(element: Element, s: string): bool
 proc attr*(element: Element, name, value: string)
+func baseURL*(document: Document): URL
 
 proc tostr(ftype: enum): string =
   return ($ftype).split('_')[1..^1].join("-").tolower()
@@ -1802,8 +1803,8 @@ func target0*(element: Element): string =
 # HTMLHyperlinkElementUtils (for <a> and <area>)
 func href0[T: HTMLAnchorElement|HTMLAreaElement](element: T): string =
   if element.attrb("href"):
-    let url = parseUrl(element.attr("href"), some(element.document.url))
-    if url.issome:
+    let url = parseURL(element.attr("href"), some(element.document.baseURL))
+    if url.isSome:
       return $url.get
 
 # <base>
@@ -2030,7 +2031,7 @@ func isHostIncludingInclusiveAncestor*(a, b: Node): bool =
         return true
   return false
 
-func baseURL*(document: Document): Url =
+func baseURL*(document: Document): URL =
   #TODO frozen base url...
   var href = ""
   for base in document.elements(TAG_BASE):