Closed ajusa closed 1 year ago
Agreed.
agreed; if you have a working PR that avoids creating a div with verbatim, then https://github.com/karaxnim/karax/pull/160 can be closed
let node = "This is an inner div <div>inner div</div>".verbatimRaw
# node == VNode("This is an inner div ")
It completely discards any other children. You probably shouldn't do this anyways (not the point of verbatim), but it also shouldn't result in discarded data.
The reason why verbatim currently uses a div is because of the above. To capture many children in one node. The way around this would be to make toDom
return a list of nodes and all the places that call it be modified to handle a list of nodes. Then the surrounding div for verbatim could be removed.
I recall that React has a special <>
/</>
syntax. Maybe we could similarly create a special "empty" node which allows a list of nodes to be returned without any additional tags being output?
Hmm, that could work as well
other frameworks append custom html comments to solve this problem iirc:
<!-- start arbitrary text #1 -->
...
<!-- end arbitrary text #1 -->
Completed in #270
Using
verbatim
shouldn't cause a wrapper div to be created, it isn't always the desired behavior. https://github.com/karaxnim/karax/pull/160 tries addressing this with a newverbatimRaw
, but I would suggest just not having verbatim create a div at all, it is super easy for the user to add a wrapper div if needed. Also,verbatim
must have a parent HTML element anyway.I'd also argue that it is pretty unintuitive for a hidden element to be created if you just want to display something like
&
properly.