Conversation
|
I thought we ignored whitespace? Perhaps what we should do for now is simply to improve the error message. If we fail because of macro component being at root, we tell people to move it inside the root element. |
|
Maybe, but I don't see a straightforward way to differentiate between a macro component and any other reason for root being false. It would be easier to special case the code to prune whitespace if the macro component returned an empty string. We pass phoenix_live_view/lib/phoenix_live_view/tag_engine.ex Lines 484 to 486 in eb161bb |
|
Maybe we trim white space after a macro component that returns nothing at the root? |
|
Yep, that's what bfe39a7 does. Let me know if you're happy with that. |
* root tracking for macro components Closes phoenixframework#3877. * prune text after empty macro component * remove prune_text_after_slot
* root tracking for macro components Closes #3877. * prune text after empty macro component * remove prune_text_after_slot
Closes #3877.
I'm not sure though if we want this, since it would still fail if you do
because the extra whitespace between the colocated hook and the div counts as text that sets root to false.
So in practice, this may not help much.