adapting edit.js with the new csslint-worker.js (v1.0.4)

This commit is contained in:
Jeremy Schomery 2017-02-08 17:23:38 +03:30
parent 03f4900506
commit e2ce5669a2

View File

@ -1349,7 +1349,7 @@ function fromMozillaFormat() {
var replaceOldStyle = this.name == "import-replace"; var replaceOldStyle = this.name == "import-replace";
popup.querySelector(".close-icon").click(); popup.querySelector(".close-icon").click();
var mozStyle = trimNewLines(popup.codebox.getValue()); var mozStyle = trimNewLines(popup.codebox.getValue());
var parser = new exports.css.Parser(), lines = mozStyle.split("\n"); var parser = new parserlib.css.Parser(), lines = mozStyle.split("\n");
var sectionStack = [{code: "", start: {line: 1, col: 1}}]; var sectionStack = [{code: "", start: {line: 1, col: 1}}];
var errors = "", oldSectionCount = editors.length; var errors = "", oldSectionCount = editors.length;
var firstAddedCM; var firstAddedCM;
@ -1357,7 +1357,7 @@ function fromMozillaFormat() {
parser.addListener("startdocument", function(e) { parser.addListener("startdocument", function(e) {
var outerText = getRange(sectionStack.last.start, (--e.col, e)); var outerText = getRange(sectionStack.last.start, (--e.col, e));
var gapComment = outerText.match(/(\/\*[\s\S]*?\*\/)[\s\n]*$/); var gapComment = outerText.match(/(\/\*[\s\S]*?\*\/)[\s\n]*$/);
var section = {code: "", start: backtrackTo(this, exports.css.Tokens.LBRACE, "end")}; var section = {code: "", start: backtrackTo(this, parserlib.css.Tokens.LBRACE, "end")};
// move last comment before @-moz-document inside the section // move last comment before @-moz-document inside the section
if (gapComment && !gapComment[1].match(/\/\*\s*AGENT_SHEET\s*\*\//)) { if (gapComment && !gapComment[1].match(/\/\*\s*AGENT_SHEET\s*\*\//)) {
section.code = gapComment[1] + "\n"; section.code = gapComment[1] + "\n";
@ -1378,7 +1378,7 @@ function fromMozillaFormat() {
}); });
parser.addListener("enddocument", function(e) { parser.addListener("enddocument", function(e) {
var end = backtrackTo(this, exports.css.Tokens.RBRACE, "start"); var end = backtrackTo(this, parserlib.css.Tokens.RBRACE, "start");
var section = sectionStack.pop(); var section = sectionStack.pop();
section.code += getRange(section.start, end); section.code += getRange(section.start, end);
sectionStack.last.start = (++end.col, end); sectionStack.last.start = (++end.col, end);