restore Chrome 49 compatibility: remove "u" flag in RegExp

since it wasn't used globally (e.g. vendor code) it made no real difference
This commit is contained in:
tophf 2018-02-28 05:15:28 +03:00
parent 6b0628a7ee
commit 0ba26072f7
4 changed files with 17 additions and 17 deletions

View File

@ -176,8 +176,8 @@
const execAt = (rx, i) => (rx.lastIndex = i) && null || rx.exec(text);
const at = (rx, i) => (rx.lastIndex = i) && null || rx.test(text);
const atWord = ch => at(/\w/uy, ch);
const atSpace = ch => at(/\s/uy, ch);
const atWord = ch => at(/\w/y, ch);
const atSpace = ch => at(/\s/y, ch);
const atTokenEnd = styles.indexOf(ch, 1);
ch += atTokenEnd < 0 ? 0 : sticky === 'before' && atWord(ch - 1) ? 0 : atSpace(ch + 1) ? 0 : 1;
@ -189,19 +189,19 @@
const isNumber = type === 'number';
const isSpace = atSpace(ch);
let wordChars =
isNumber ? /[-+\w.%]/uy :
isCss ? /[-\w@]/uy :
isSpace ? /\s/uy :
atWord(ch) ? /\w/uy : /[^\w\s]/uy;
isNumber ? /[-+\w.%]/y :
isCss ? /[-\w@]/y :
isSpace ? /\s/y :
atWord(ch) ? /\w/y : /[^\w\s]/y;
let a = ch;
while (a && at(wordChars, a)) a--;
a += !a && at(wordChars, a) || isCss && at(/[.!#@]/uy, a) ? 0 : at(wordChars, a + 1);
a += !a && at(wordChars, a) || isCss && at(/[.!#@]/y, a) ? 0 : at(wordChars, a + 1);
let b, found;
if (isNumber) {
b = a + execAt(/[+-]?[\d.]+(e\d+)?|$/uyi, a)[0].length;
b = a + execAt(/[+-]?[\d.]+(e\d+)?|$/yi, a)[0].length;
found = b >= ch;
if (!found) {
a = b;
@ -210,7 +210,7 @@
}
if (!found) {
wordChars = isCss ? /[-\w]*/uy : new RegExp(wordChars.source + '*', 'uy');
wordChars = isCss ? /[-\w]*/y : new RegExp(wordChars.source + '*', 'uy');
b = ch + execAt(wordChars, ch)[0].length;
}
@ -226,7 +226,7 @@ CodeMirror.hint && (() => {
const USO_VAR = 'uso-variable';
const USO_VALID_VAR = 'variable-3 ' + USO_VAR;
const USO_INVALID_VAR = 'error ' + USO_VAR;
const RX_IMPORTANT = /(i(m(p(o(r(t(a(nt?)?)?)?)?)?)?)?)?(?=\b|\W|$)/iyu;
const RX_IMPORTANT = /(i(m(p(o(r(t(a(nt?)?)?)?)?)?)?)?)?(?=\b|\W|$)/iy;
const originalHelper = CodeMirror.hint.css || (() => {});
CodeMirror.registerHelper('hint', 'css', function (cm) {
@ -238,7 +238,7 @@ CodeMirror.hint && (() => {
if (style && (style.startsWith('comment') || style.startsWith('string'))) {
return originalHelper(cm);
}
if (text[ch - 1] === '!' && /i|\W|^$/iu.test(text[ch] || '')) {
if (text[ch - 1] === '!' && /i|\W|^$/i.test(text[ch] || '')) {
RX_IMPORTANT.lastIndex = ch;
return {
list: ['important'],

View File

@ -34,7 +34,7 @@ function parseMozFormat({code, styleId}) {
// move last comment before @-moz-document inside the section
if (!lastCmt.includes('AGENT_SHEET') &&
!lastCmt.includes('==') &&
!/==userstyle==/iu.test(lastCmt)) {
!/==userstyle==/i.test(lastCmt)) {
if (lastCmt) {
section.code = lastCmt + '\n';
outerText = outerText.slice(0, -lastCmt.length);

View File

@ -112,7 +112,7 @@ class Reporter {
//eslint-disable-next-line no-var
var CSSLint = (() => {
const RX_EMBEDDED = /\/\*\s*csslint\s+((?:[^*]|\*(?!\/))+?)\*\//igu;
const RX_EMBEDDED = /\/\*\s*csslint\s+((?:[^*]|\*(?!\/))+?)\*\//ig;
const EBMEDDED_RULE_VALUE_MAP = {
// error
'true': 2,

View File

@ -3354,15 +3354,15 @@ self.parserlib = (() => {
}
readUnquotedURL(first) {
return this.readChunksWithEscape(first, /[-!#$%&*-[\]-~\u00A0-\uFFFF]+/yu);
return this.readChunksWithEscape(first, /[-!#$%&*-[\]-~\u00A0-\uFFFF]+/y);
}
readName(first) {
return this.readChunksWithEscape(first, /[-_\da-zA-Z\u00A0-\uFFFF]+/yu);
return this.readChunksWithEscape(first, /[-_\da-zA-Z\u00A0-\uFFFF]+/y);
}
readEscape() {
const cp = this._reader.readMatch(/[0-9a-f]{1,6}\b\s*/iyu);
const cp = this._reader.readMatch(/[0-9a-f]{1,6}\b\s*/iy);
return cp ? String.fromCodePoint(parseInt(cp, 16)) : this._reader.read();
}
@ -3388,7 +3388,7 @@ self.parserlib = (() => {
readComment(first) {
return first +
this._reader.readCount(2 - first.length) +
this._reader.readMatch(/([^*]|\*(?!\/))*(\*\/|$)/yu);
this._reader.readMatch(/([^*]|\*(?!\/))*(\*\/|$)/y);
}
}