csslint: CSS variables

* kinda fixes #149
* primitive recognition only
  (it's not like we expect csslint to be smart anyway)
This commit is contained in:
tophf 2017-08-13 13:32:24 +03:00
parent d2b81be9d1
commit d49e44ddc1

View File

@ -4761,7 +4761,12 @@ TokenStream.prototype = mix(new TokenStreamBase(), {
*/ */
case "-": case "-":
if (reader.peek() === "-") { //could be closing HTML-style comment if (reader.peek() === "-") { //could be closing HTML-style comment
//or CSS variable
if (/\w/.test(reader.peek(2))) {
token = this.identOrFunctionToken(c, startLine, startCol);
} else {
token = this.htmlCommentEndToken(c, startLine, startCol); token = this.htmlCommentEndToken(c, startLine, startCol);
}
} else if (isNameStart(reader.peek())) { } else if (isNameStart(reader.peek())) {
token = this.identOrFunctionToken(c, startLine, startCol); token = this.identOrFunctionToken(c, startLine, startCol);
} else { } else {
@ -5903,7 +5908,7 @@ var Validation = module.exports = {
value = expression.value, value = expression.value,
part; part;
result = Matcher.parse(types).match(expression); result = Matcher.parse(types + ' | <var>').match(expression);
if (!result) { if (!result) {
if (expression.hasNext() && !expression.isFirst()) { if (expression.hasNext() && !expression.isFirst()) {
@ -6270,6 +6275,8 @@ copy(ValidationTypes, {
return part.type === "uri"; return part.type === "uri";
}, },
"<var>": "var()",
"<width>": "<margin-width>" "<width>": "<margin-width>"
}, },