diff options
Diffstat (limited to 'src/html')
-rw-r--r-- | src/html/catom.nim | 4 | ||||
-rw-r--r-- | src/html/dom.nim | 6 | ||||
-rw-r--r-- | src/html/env.nim | 12 |
3 files changed, 15 insertions, 7 deletions
diff --git a/src/html/catom.nim b/src/html/catom.nim index f22d74ef..0ff7b949 100644 --- a/src/html/catom.nim +++ b/src/html/catom.nim @@ -9,6 +9,7 @@ import monoucha/javascript import monoucha/jserror import monoucha/tojs import types/opt +import utils/twtstr # create a static enum compatible with chame/tags @@ -33,6 +34,7 @@ macro makeStaticAtom = satColor = "color" satCols = "cols" satColspan = "colspan" + satContent = "content" satCrossorigin = "crossorigin" satDOMContentLoaded = "DOMContentLoaded" satDefer = "defer" @@ -102,7 +104,7 @@ macro makeStaticAtom = if t == TAG_UNKNOWN: continue let tn = $t - let name = "sat" & tn[0].toUpperAscii() & tn.substr(1) + let name = "sat" & tn[0].toUpperAscii() & tn.substr(1).kebabToCamelCase() seen.incl(tn) decl0.add(newNimNode(nnkEnumFieldDef).add(ident(name), newStrLitNode(tn))) for i, f in StaticAtom0.getType(): diff --git a/src/html/dom.nim b/src/html/dom.nim index 7491e56b..a2153acb 100644 --- a/src/html/dom.nim +++ b/src/html/dom.nim @@ -2414,6 +2414,12 @@ func findAnchor*(document: Document; id: string): Element = return child return nil +proc findMetaRefresh*(document: Document): Element = + for child in document.elements(TAG_META): + if child.attr(satHttpEquiv) == "refresh": + return child + return nil + func focus*(document: Document): Element = return document.internalFocus diff --git a/src/html/env.nim b/src/html/env.nim index 131d7b4d..187968e3 100644 --- a/src/html/env.nim +++ b/src/html/env.nim @@ -112,13 +112,13 @@ proc fetch(window: Window; input: JSValue; init = none(RequestInit)): # Forward declaration hack windowFetch = fetch -proc setTimeout(window: Window; handler: JSValue; timeout = 0i32): int32 - {.jsfunc.} = - return window.timeouts.setTimeout(ttTimeout, handler, timeout) +proc setTimeout(window: Window; handler: JSValue; timeout = 0i32; + args: varargs[JSValue]): int32 {.jsfunc.} = + return window.timeouts.setTimeout(ttTimeout, handler, timeout, args) -proc setInterval(window: Window; handler: JSValue; interval = 0i32): int32 - {.jsfunc.} = - return window.timeouts.setTimeout(ttInterval, handler, interval) +proc setInterval(window: Window; handler: JSValue; interval = 0i32; + args: varargs[JSValue]): int32 {.jsfunc.} = + return window.timeouts.setTimeout(ttInterval, handler, interval, args) proc clearTimeout(window: Window; id: int32) {.jsfunc.} = window.timeouts.clearTimeout(id) |