We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
When E4X options is enabled, some pure (non-e4x) javascript statement is misinterpreted as xml.
The code looked like this before beautification:
str =A++<22 ? "</x>" : "";
The code should have looked like this after beautification:
str = A++ < 22 ? "</x>" : "";
The code actually looked like this after beautification:
str = A++<22 ? "</x> " : " ";
The followings are dump of tokens generated in beautify.js. If e4x options is enabled, _read_xml() in beautify.js treats <22 ? "</x> as TK_STRING.
beautify.js
_read_xml()
<22 ? "</x>
TK_STRING
Object { type: "TK_WORD", text: "str", comments_before: null, newlines: 0, whitespace_before: "", parent: null, next: null, previous: null, opened: null, closed: null, … } Object { type: "TK_EQUALS", text: "=", comments_before: null, newlines: 0, whitespace_before: " ", parent: null, next: null, previous: null, opened: null, closed: null, … } Object { type: "TK_WORD", text: "A", comments_before: null, newlines: 0, whitespace_before: "", parent: null, next: null, previous: null, opened: null, closed: null, … } Object { type: "TK_OPERATOR", text: "++", comments_before: null, newlines: 0, whitespace_before: "", parent: null, next: null, previous: null, opened: null, closed: null, … } Object { type: "TK_STRING", text: '<22 ? "</x>', comments_before: null, newlines: 0, whitespace_before: "", parent: null, next: null, previous: null, opened: null, closed: null, … }
js-beautify v1.15.1
{ indent_size: 2, indent_char: ' ', eol: '\n', max_preserve_newlines: 5, preserve_newlines: true, keep_array_indentation: false, break_chained_methods: false, indent_scripts: false, brace_style: 'collapse', space_before_conditional: true, unescape_strings: false, wrap_line_length: 150, e4x: true, }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Description
When E4X options is enabled, some pure (non-e4x) javascript statement is misinterpreted as xml.
Input
The code looked like this before beautification:
Expected Output
The code should have looked like this after beautification:
Actual Output
The code actually looked like this after beautification:
Steps to Reproduce
The followings are dump of tokens generated in
beautify.js
.If e4x options is enabled,
_read_xml()
inbeautify.js
treats<22 ? "</x>
asTK_STRING
.Settings
js-beautify v1.15.1
The text was updated successfully, but these errors were encountered: