From adc4282471ee15e2c91b7da7d5398cd1b8eee978 Mon Sep 17 00:00:00 2001 From: Marijn Haverbeke Date: Fri, 27 Oct 2023 10:34:12 +0200 Subject: [PATCH] [jsx mode] Narrow test for trailing-comma generic Issue https://github.com/codemirror/codemirror5/pull/7073 --- mode/jsx/jsx.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mode/jsx/jsx.js b/mode/jsx/jsx.js index 83141c0567..35ac608e16 100644 --- a/mode/jsx/jsx.js +++ b/mode/jsx/jsx.js @@ -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)