Skip to content

Commit cd4dfbc

Browse files
shayanhabibiMangelMaxime
authored andcommitted
Documentation regarding possible consequences for self closing tag in JSX rendering
1 parent 956f668 commit cd4dfbc

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/Fable.Transforms/BabelPrinter.fs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,10 @@ module PrinterExtensions =
455455
printer.PopIndentation()
456456

457457
if List.isEmpty children then
458+
// Self closing tag if el has no children. Matches expected behaviour of JSX with React/Solid etc
459+
// https://react-cn.github.io/react/tips/self-closing-tag.html
460+
// Self closing tag is invalid in HTML5 spec
461+
// https://stackoverflow.com/questions/3558119/are-non-void-self-closing-tags-valid-in-html5
458462
printer.Print(" />")
459463
else
460464
printer.Print(">")

0 commit comments

Comments
 (0)