Skip to content

Conversation

@copybara-service
Copy link

If emitLoggingCommands was called directly on a <velog> element with more than 1 child:

  • The in-place mutations would succeed (i.e., make <velog>'s children its siblings then delete <velog>)
  • All elements of the newChildren array then get reparented to a new DocumentFragment before returning from emitLoggingCommands, effectively deleting them from the new parent.

This refactor returns the lone element in newElements if len==1, returning a DocumentFragment of newElements otherwise.

…ith more than 1 child:

*   The in-place mutations would succeed (i.e., make `<velog>`'s children its siblings then delete `<velog>`)
*   All elements of the `newChildren` array then get reparented to a new `DocumentFragment` before returning from `emitLoggingCommands`, effectively deleting them from the new parent.

This refactor returns the lone element in `newElements` if len==1, returning a `DocumentFragment` of `newElements` otherwise.

PiperOrigin-RevId: 850245530
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants