-
I could not find a way to add raw html as a child element. A DocumentFragment can be used to add HTML for DOM rendering but does not work on the server. Is there an API to render raw html? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
|
Beta Was this translation helpful? Give feedback.
-
Mini-Van For sample usage, you can refer to this test case: fragment: () => {
const fragment = new DocumentFragment
fragment.append(div(1), div(2))
const dom = div(div(0), fragment)
assertEq(dom.outerHTML, "<div><div>0</div><div>1</div><div>2</div></div>")
} Let me know if it's helpful for your use cases. The solution is a little bit hacky, though. Future changes of |
Beta Was this translation helpful? Give feedback.
Mini-Van
0.5.3
was released. The0.5.3
release added support ofNode
type (derived fromElement["childNode"]
) as parameters of tag functions. Thus with this release,DocumentFragment
(which is a subtype ofNode
) becomes valid parameter of tag functions.For sample usage, you can refer to this test case:
Let me know if it's helpful for your use cases.
The solution is a little bit hacky, though. Future changes of
childNode
implementation in the 3rd party DOM library you're using might br…