diff --git a/js/src/javascript/tokenizer.js b/js/src/javascript/tokenizer.js
index 6e346650b..71e06d399 100644
--- a/js/src/javascript/tokenizer.js
+++ b/js/src/javascript/tokenizer.js
@@ -126,7 +126,7 @@ var Tokenizer = function(input_string, options) {
html_comment_end: pattern_reader.matching(/-->/),
include: pattern_reader.starting_with(/#include/).until_after(acorn.lineBreak),
shebang: pattern_reader.starting_with(/#!/).until_after(acorn.lineBreak),
- xml: pattern_reader.matching(/[\s\S]*?<(\/?)([-a-zA-Z:0-9_.]+|{[\s\S]+?}|!\[CDATA\[[\s\S]*?\]\])(\s+{[\s\S]+?}|\s+[-a-zA-Z:0-9_.]+|\s+[-a-zA-Z:0-9_.]+\s*=\s*('[^']*'|"[^"]*"|{[\s\S]+?}))*\s*(\/?)\s*>/),
+ xml: pattern_reader.matching(/[\s\S]*?<(\/?)([-a-zA-Z:0-9_.]+|{[\s\S]+?}|!\[CDATA\[[\s\S]*?\]\]|)(\s+{[\s\S]+?}|\s+[-a-zA-Z:0-9_.]+|\s+[-a-zA-Z:0-9_.]+\s*=\s*('[^']*'|"[^"]*"|{[\s\S]+?}))*\s*(\/?)\s*>/),
single_quote: templatable.until(/['\\\n\r\u2028\u2029]/),
double_quote: templatable.until(/["\\\n\r\u2028\u2029]/),
template_text: templatable.until(/[`\\$]/),
diff --git a/js/test/generated/beautify-javascript-tests.js b/js/test/generated/beautify-javascript-tests.js
index 7bb597bad..35aab5a11 100644
--- a/js/test/generated/beautify-javascript-tests.js
+++ b/js/test/generated/beautify-javascript-tests.js
@@ -4418,6 +4418,17 @@ function run_javascript_tests(test_obj, Urlencoded, js_beautify, html_beautify,
' {children}\n' +
' {a + b}>\n' +
');');
+ bt(
+ 'class Columns extends React.Component {\n' +
+ ' render() {\n' +
+ ' return (\n' +
+ ' <>\n' +
+ '
Hello | \n' +
+ ' World | \n' +
+ ' >\n' +
+ ' );\n' +
+ ' }\n' +
+ '}');
//============================================================
diff --git a/python/jsbeautifier/javascript/tokenizer.py b/python/jsbeautifier/javascript/tokenizer.py
index 00f39da22..2e01a23f7 100644
--- a/python/jsbeautifier/javascript/tokenizer.py
+++ b/python/jsbeautifier/javascript/tokenizer.py
@@ -119,7 +119,7 @@ def __init__(self):
directives_core = Directives(r"/\*", r"\*/")
xmlRegExp = re.compile(
- r'[\s\S]*?<(\/?)([-a-zA-Z:0-9_.]+|{[\s\S]+?}|!\[CDATA\[[\s\S]*?\]\])(\s+{[\s\S]+?}|\s+[-a-zA-Z:0-9_.]+|\s+[-a-zA-Z:0-9_.]+\s*=\s*(\'[^\']*\'|"[^"]*"|{[\s\S]+?}))*\s*(/?)\s*>'
+ r'[\s\S]*?<(\/?)([-a-zA-Z:0-9_.]+|{[\s\S]+?}|!\[CDATA\[[\s\S]*?\]\]|)(\s+{[\s\S]+?}|\s+[-a-zA-Z:0-9_.]+|\s+[-a-zA-Z:0-9_.]+\s*=\s*(\'[^\']*\'|"[^"]*"|{[\s\S]+?}))*\s*(/?)\s*>'
)
diff --git a/python/jsbeautifier/tests/generated/tests.py b/python/jsbeautifier/tests/generated/tests.py
index 3ea33818d..87cfed911 100644
--- a/python/jsbeautifier/tests/generated/tests.py
+++ b/python/jsbeautifier/tests/generated/tests.py
@@ -4168,6 +4168,17 @@ def unicode_char(value):
' {children}\n' +
' {a + b}>\n' +
');')
+ bt(
+ 'class Columns extends React.Component {\n' +
+ ' render() {\n' +
+ ' return (\n' +
+ ' <>\n' +
+ ' Hello | \n' +
+ ' World | \n' +
+ ' >\n' +
+ ' );\n' +
+ ' }\n' +
+ '}')
#============================================================
diff --git a/test/data/javascript/tests.js b/test/data/javascript/tests.js
index ad1215496..4a30146e5 100644
--- a/test/data/javascript/tests.js
+++ b/test/data/javascript/tests.js
@@ -2490,6 +2490,20 @@ exports.test_data = {
' {a + b}>',
');'
]
+ },
+ {
+ unchanged: [
+ 'class Columns extends React.Component {',
+ ' render() {',
+ ' return (',
+ ' <>',
+ ' Hello | ',
+ ' World | ',
+ ' >',
+ ' );',
+ ' }',
+ '}'
+ ]
}
]
},