From 2e86c95842dd39c61a6beff028f14ed717124854 Mon Sep 17 00:00:00 2001 From: tophf Date: Sat, 10 Jun 2017 12:41:44 +0300 Subject: [PATCH] csslint: fire startdocument on { --- csslint/csslint-worker.js | 3 ++- edit.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/csslint/csslint-worker.js b/csslint/csslint-worker.js index 75b5df44..46a72d4b 100644 --- a/csslint/csslint-worker.js +++ b/csslint/csslint-worker.js @@ -1675,7 +1675,6 @@ Parser.prototype = function() { } tokenStream.mustMatch(Tokens.LBRACE); - this._readWhitespace(); this.fire({ type: "startdocument", @@ -1685,6 +1684,8 @@ Parser.prototype = function() { col: token.startCol }); + this._readWhitespace(); // Stylus hack + var ok = true; while (ok) { switch (tokenStream.peek()) { diff --git a/edit.js b/edit.js index 9bf5c618..2f9ede93 100644 --- a/edit.js +++ b/edit.js @@ -1576,7 +1576,7 @@ function fromMozillaFormat() { } function backtrackTo(parser, tokenType, startEnd) { var tokens = parser._tokenStream._lt; - for (var i = tokens.length - 2; i >= 0; --i) { + for (var i = parser._tokenStream._ltIndex - 1; i >= 0; --i) { if (tokens[i].type == tokenType) { return {line: tokens[i][startEnd+"Line"], col: tokens[i][startEnd+"Col"]}; }