[JSX] Print Empty Elem - Self closing tags when elem has no children#4037
[JSX] Print Empty Elem - Self closing tags when elem has no children#4037MangelMaxime merged 5 commits intofable-compiler:mainfrom
Conversation
|
I don't remember if there was a specific reason not to close the tag immediately but probably it should be fine. Do we need a space before |
|
Well @Lanayx identified that it is not accepted under the HTML5 spec; however it is in JSX/React etc. Without this, spreading properties that contain children are overridden without explicit children between the open and closing tags. Since this transformation only applies to JSX, I hope it would be fine. If the functionality is being used to template HTML5, then it might cause issue. Most browsers accept it anyway, but there can be undefined behaviour in some instances. I can try and grok the tests and put something together, but don't know whether they'll be up to scratch |
|
Thanks for the explanation. Could you please add a succinct version as a comment to the code. This way if in the future we want to generate the closing tag to conform with HTML5 we'll remember there's a reason to do it like this. |
|
Thanks for having a look, your work on this project, and for the helpful comments! I've added the documentation with some source references but will have to defer writing up the tests to tomorrow for this and #4038 . For the time being, there's nothing obstructing me since I can use a local build of fable with some confidence the functionalities will be merged in some way. |
I'm trying to enable and enforce the JSX print to self close tags when they don't have children. This way property spreads or children attributes aren't overridden in the Oxpecker.Solid dsl.
Draft:
I'd really appreciate any direction to where tests for this would be contained and how to further this pull request to completion.