Page MenuHomePhabricator

CodeMirror 6 uses ES9 unicode property escapes
Closed, InvalidPublic

Description

See T381537#10409889, current uses are

Browsers does not support ES9 unicode property escapes are (browsers in italics will be unable to connect to Wikimedia wikis soon for lacking TLS 1.3):

  • Chrome 63
  • Firefox 58-62, 63-77
  • Opera 50

Event Timeline

I presume this is an oversight from the CodeMirror developer, or the unicode property escapes don't break anything in older browsers. I suspect the latter, as I see a try/catch in the code.

CodeMirror is advertised as being distributed in purely ES2015 syntax.

I'm not sure anything needs to be done here, unless we are aware of breakage in browsers we are meant to support.

I suspect the latter, as I see a try/catch in the code.

Thanks for pointing this out! I test some malformed RegExp constructor calls in different modern browsers, and the try-catch block works well to prevent syntax errors.

As T382350#10411205 explains, CodeMirror 6 uses a RegExp constructor inside a try-catch block to prevent SyntaxError in an old browser. Furthermore, a polyfill is included in the library when the unicode property escape is unavailable. The only problem occurs with the exported completeAnyWord function, which has incomplete support for non-ASCII alphanumeric characters in an old browser. However, this function is not suitable for Wikitext autocompletion, and I do not think it will be used anywhere in the extension in the foreseeable future.

Em, it should not be a problem as long as the linter, validator and minifier does not do wrong. All of these currently does not touch inside dynamically created regex at all.