fix: use self-closing tags when children are implictly hidden#299
Open
JoshBashed wants to merge 1 commit intoCoreOffice:mainfrom
Open
fix: use self-closing tags when children are implictly hidden#299JoshBashed wants to merge 1 commit intoCoreOffice:mainfrom
JoshBashed wants to merge 1 commit intoCoreOffice:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #298
Important
Although the issue was generated using AI tools, the PR's code was written by a human.
When a choice case uses
_0 = ""to inline an associated value whose contents are XML attributes only, the encoder was emitting an empty open/close pair (<Tag Attr="..."></Tag>) instead of a self-closing tag (<Tag Attr="..." />).The attributes correctly bubbled up to the parent via
formatXMLAttributes, but the empty-keyed phantom child stayed in the elements list, so!elements.isEmptyforced the encoder onto the open/close path.Changes
isPracticallyEmptyto recursively check if a tag can be self-closing.Important
formatXMLAttributesdoesn't recognize tags with no elements inside children and this PR doesn't change that behavior.isPracticallyEmptywhen deciding whether to self-close an element.InlinePropertyTeststo ensure the behavior remains.