Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
silently doing nothing seems like the worst of all possible behaviors to me. I'd either append the new element or just leave things as is. this doesn't seem like a very big problem, so I'm not sure it's worth the extra code and complication. if we did want this then you should probably do
!==
and write a test, but I'm rather hesitant about this additionThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @benmccann, thanks for looking at this. I wasn't sure about the right way to approach it, but I'd be happy to revise. My limited understanding is the insert function creates the instructions to mount the elements into the target (in this case the document). The top level document can only have 1 element/child (e.g
<html>
), so it throws this error. Assuming we use!==
it does silently prevent this, but would there ever be a situation where we would want to insert on the document? Maybe there's a better approach though, can you help me understand what I'd need to do to "append the new element?" Thank you!