natemoo-re / ultrahtml

Other
523 stars 8 forks source link

VOID_TAGS should include svg void tags #48

Closed jasikpark closed 1 year ago

jasikpark commented 1 year ago

https://github.com/natemoo-re/ultrahtml/blob/2cb77629b075799c7da03742bf7c7dd7681d9166/src/index.ts#L86

should include svg void tags like path

I'll try to find the full list

Looking to solve https://github.com/jasikpark/astro-svg-loader/issues/58 which depends on the wonderful ultrahtml :p

jasikpark commented 1 year ago

though hmm maybe they always permit children? https://github.com/fb55/htmlparser2/issues/187

would be nice for empty nodes to be rendered in the more concise way though, are there any elements that can't be reduced to </> instead of <></> when empty?

natemoo-re commented 1 year ago

would be nice for empty nodes to be rendered in the more concise way though, are there any elements that can't be reduced to </> instead of <></> when empty?

Hmm, most HTML elements, I think! I might be able to add something in the AST that signals if something was self-closing as authored, though.