eat unclosed comments

This commit is contained in:
tophf 2018-01-30 18:45:29 +03:00
parent 90aacefff8
commit 02989edb05
4 changed files with 4 additions and 4 deletions

View File

@ -3,7 +3,7 @@
const RX_NAMESPACE = /\s*(@namespace\s+(?:\S+\s+)?url\(http:\/\/.*?\);)\s*/g;
const RX_CHARSET = /\s*@charset\s+(['"]).*?\1\s*;\s*/g;
const RX_CSS_COMMENTS = /\/\*[\s\S]*?\*\//g;
const RX_CSS_COMMENTS = /\/\*[\s\S]*?(?:\*\/|$)/g;
// eslint-disable-next-line no-var
var SLOPPY_REGEXP_PREFIX = '\0';

View File

@ -484,7 +484,7 @@ function createAppliesToLineWidget(cm) {
const text = cm.getValue();
const re = /^[\t ]*@-moz-document[\s\n]+/gm;
const applyRe = new RegExp([
/(?:\/\*[^*]*\*\/[\s\n]*)*/,
/(?:\/\*[\s\S]*?(?:\*\/\s*|$))*/,
/(url|url-prefix|domain|regexp)/,
/\(((['"])(?:\\\\|\\\n|\\\3|[^\n])*?\3|[^)\n]*)\)\s*(,\s*)?/,
].map(rx => rx.source).join(''), 'giy');

View File

@ -195,7 +195,7 @@ function setupCodeMirror(sectionDiv, code, index) {
const text = event.clipboardData.getData('text') || '';
if (
text.includes('@-moz-document') &&
text.replace(/\/\*[\s\S]*?\*\//g, '')
text.replace(/\/\*[\s\S]*?(?:\*\/|$)/g, '')
.match(/@-moz-document[\s\r\n]+(url|url-prefix|domain|regexp)\(/)
) {
event.preventDefault();

View File

@ -48,7 +48,7 @@
')', 'gi');
const RX_DETECT_FUNC = /(rgb|hsl)a?\(/iy;
const RX_COMMENT = /\/\*(?:.(?!\*\/))*(?:.?\*\/|$)/g;
const RX_COMMENT = /\/\*[\s\S]*?(?:\*\/|$)/g;
const SPACE1K = ' '.repeat(1000);
// milliseconds to work on invisible colors per one run