maciejhirsz / kobold

Easy declarative web interfaces.
https://docs.rs/kobold/
Mozilla Public License 2.0
385 stars 7 forks source link

Empty tag that is not self-closing generates invalid javascript #7

Closed ruuda closed 1 year ago

ruuda commented 1 year ago

The following snippet causes Kobold to generate invalid javascript:

html! {
    <svg></svg>
}

generates

export function __e0_77bcc8fe2fa4f331() {
let e0=document.createElement("svg");
e0.append);
return e0;
}

which then causes

Uncaught SyntaxError: Unexpected token ')' (at inline0.js:3:10)

<svg/> and <svg>""</svg> both work fine, only an empty tag causes this problem.

maciejhirsz commented 1 year ago

Thanks for this, and sorry for being so slow, I was taking a bit of a coding break. Fixed and published in 0.4.1.

ruuda commented 1 year ago

Thanks for the fix!