Skip to content

Issues/2372 cdata handling#2454

Open
SarthakDudhe wants to merge 13 commits into
beautifier:mainfrom
SarthakDudhe:issues/2372-cdata-handling
Open

Issues/2372 cdata handling#2454
SarthakDudhe wants to merge 13 commits into
beautifier:mainfrom
SarthakDudhe:issues/2372-cdata-handling

Conversation

@SarthakDudhe
Copy link
Copy Markdown

Fixed #2372 by making the JavaScript E4X/XML literal tokenizer treat CDATA as “anything up to the real closing ]]>” instead of stopping at the first ].
What changed:
Updated the XML literal regex in js/src/javascript/tokenizer.js so the CDATA branch now accepts ] characters inside the CDATA body.
Mirrored the same regex change in python/jsbeautifier/javascript/tokenizer.py to keep the Python implementation aligned.
Added a regression test in test/data/javascript/tests.js for:
xml=;
The new test proves the formatter now preserves the XML literal instead of breaking it into invalid markup when ] appears inside CDATA.

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.

Custom tags with dash character are considered inline and not formatted properly

1 participant