USO-vars in CSSLint

This commit is contained in:
tophf 2017-11-23 20:50:07 +03:00
parent 60247a6443
commit 7e4683d417
2 changed files with 7 additions and 10 deletions

View File

@ -182,7 +182,7 @@
string[start + 3] === '[' && string[start + 3] === '[' &&
string[pos - 3] === ']' && string[pos - 3] === ']' &&
string[pos - 4] === ']') { string[pos - 4] === ']') {
if (editor && if (typeof editor !== 'undefined' &&
Object.hasOwnProperty.call( Object.hasOwnProperty.call(
editor.getStyle().usercssData.vars, editor.getStyle().usercssData.vars,
string.slice(start + 4, pos - 4))) { string.slice(start + 4, pos - 4))) {

View File

@ -5662,7 +5662,7 @@ var Tokens = module.exports = [
// ignorables // ignorables
{ name: "S", whitespace: true/*, channel: "ws"*/ }, { 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 // attribute equality
{ name: "INCLUDES", text: "~=" }, { name: "INCLUDES", text: "~=" },
@ -7107,15 +7107,12 @@ TokenStreamBase.prototype = {
tokenTypes = [tokenTypes]; tokenTypes = [tokenTypes];
} }
var tt = this.get(channel), do {
i = 0, var tt = this.get(channel);
len = tokenTypes.length; if (tokenTypes.includes(tt)) {
while (i < len) {
if (tt === tokenTypes[i++]) {
return true; return true;
} }
} } while (tt === 4 && this.LA(0) !== 0);
//no match found, put the token back //no match found, put the token back
this.unget(); this.unget();
@ -7140,7 +7137,7 @@ TokenStreamBase.prototype = {
tokenTypes = [tokenTypes]; tokenTypes = [tokenTypes];
} }
if (!this.match.apply(this, arguments)) { if (!this.match(tokenTypes)) {
token = this.LT(1); token = this.LT(1);
throw new SyntaxError("Expected " + this._tokenData[tokenTypes[0]].name + throw new SyntaxError("Expected " + this._tokenData[tokenTypes[0]].name +
" at line " + token.startLine + ", col " + token.startCol + ".", token.startLine, token.startCol); " at line " + token.startLine + ", col " + token.startCol + ".", token.startLine, token.startCol);