[jsx mode] Narrow test for trailing-comma generic

Issue https://github.com/codemirror/codemirror5/pull/7073
This commit is contained in:
Marijn Haverbeke 2023-10-27 10:34:12 +02:00
parent bcb86262e8
commit adc4282471
1 changed files with 2 additions and 1 deletions

View File

@ -103,7 +103,8 @@
}
function jsToken(stream, state, cx) {
if (stream.peek() == "<" && !/,\s*>/.test(stream.string) && jsMode.expressionAllowed(stream, cx.state)) {
if (stream.peek() == "<" && !stream.match(/^<([^<>]|<[^>]*>)+,\s*>/, false) &&
jsMode.expressionAllowed(stream, cx.state)) {
state.context = new Context(CodeMirror.startState(xmlMode, jsMode.indent(cx.state, "", "")),
xmlMode, 0, state.context)
jsMode.skipExpression(cx.state)