-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
An element with non-undefined children should clear the node’s actual children. #167
Comments
My current thinking is that this behavior should be based on a This would technically be a breaking change. |
On second thought, I think I’m gonna make this a non-breaking change because whenever I encounter this behavior it feels more like a bug than anything. |
On third thought, while doing an |
“Fixed” or “Changed” in 0.3.7 |
Rendering something like
<div>{[]}</div>
will fail to clear the div of user-created DOM nodes (my current use-case is a content-editable). This was done so that the user could manually insert children into crank-created DOM nodes without having Crank interfere. Currently, we check the length of the normalized array of child nodes passed into thearrange()
method, but I sorta want DOM nodes to be cleared in the case of an empty array, or a component element with no children, for instance. Maybe we could refine the heuristic to check that the actualchildren
prop is nullish or maybe evenundefined
. Think more about this heuristic.Related to #158, except that issue concerns the root DOM node which we render into, while this issue seems more about any rendered DOM node, and in this issue we want the opposite effect (clear out the DOM node as opposed to preserve the DOM node’s previous children).
The text was updated successfully, but these errors were encountered: