From 7e4683d417fa5aefc1b490e51417d6d672598c86 Mon Sep 17 00:00:00 2001 From: tophf Date: Thu, 23 Nov 2017 20:50:07 +0300 Subject: [PATCH] USO-vars in CSSLint --- edit/codemirror-default.js | 2 +- vendor-overwrites/csslint/csslint-worker.js | 15 ++++++--------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/edit/codemirror-default.js b/edit/codemirror-default.js index 9a687770..f9c6f248 100644 --- a/edit/codemirror-default.js +++ b/edit/codemirror-default.js @@ -182,7 +182,7 @@ string[start + 3] === '[' && string[pos - 3] === ']' && string[pos - 4] === ']') { - if (editor && + if (typeof editor !== 'undefined' && Object.hasOwnProperty.call( editor.getStyle().usercssData.vars, string.slice(start + 4, pos - 4))) { diff --git a/vendor-overwrites/csslint/csslint-worker.js b/vendor-overwrites/csslint/csslint-worker.js index 8bd28f1e..02428485 100644 --- a/vendor-overwrites/csslint/csslint-worker.js +++ b/vendor-overwrites/csslint/csslint-worker.js @@ -5662,7 +5662,7 @@ var Tokens = module.exports = [ // ignorables { name: "S", whitespace: true/*, channel: "ws"*/ }, - { name: "COMMENT", comment: true, hide: true, channel: "comment" }, + { name: "COMMENT", whitespace: true, comment: true, hide: true/*, channel: "comment"*/ }, // attribute equality { name: "INCLUDES", text: "~=" }, @@ -7107,15 +7107,12 @@ TokenStreamBase.prototype = { tokenTypes = [tokenTypes]; } - var tt = this.get(channel), - i = 0, - len = tokenTypes.length; - - while (i < len) { - if (tt === tokenTypes[i++]) { + do { + var tt = this.get(channel); + if (tokenTypes.includes(tt)) { return true; } - } + } while (tt === 4 && this.LA(0) !== 0); //no match found, put the token back this.unget(); @@ -7140,7 +7137,7 @@ TokenStreamBase.prototype = { tokenTypes = [tokenTypes]; } - if (!this.match.apply(this, arguments)) { + if (!this.match(tokenTypes)) { token = this.LT(1); throw new SyntaxError("Expected " + this._tokenData[tokenTypes[0]].name + " at line " + token.startLine + ", col " + token.startCol + ".", token.startLine, token.startCol);