Open timotheecour opened 5 years ago
EDIT:
cloneNode
is needed to insert same DOM Node twice, see https://stackoverflow.com/questions/20203143/how-to-insert-the-same-html-element-twice
# workaround
import karax / [kbase, vdom, kdom, karax, karaxdsl]
import js/jsffi
var elem = document.createTextNode("hello world")
let elem2 = elem.cloneNode(false)
proc createDom(): VNode =
result = buildHtml(tdiv):
dthunk(elem)
# dthunk(elem) # would give error
dthunk(elem2) # works
when isMainModule:
setRenderer createDom, "ROOT"
but maybe karax could provide a better error msg in this case, pointing to the 2 usages of the same Node; so leaving this issue open as low priority
D20190929T173159 reduced example:
gives: Uncaught Error: Error: unhandled exception: /Users/timothee/git_clone/nim/karax/karax/karax.nim(649, 12)
same(kxi.currentTree, document.getElementById(kxi.rootId))
[AssertionError](same error as https://github.com/pragmagic/karax/issues/86 but seems unrelated)