diff --git a/src/core/utils.js b/src/core/utils.js index 677b8d90..5ba837c6 100644 --- a/src/core/utils.js +++ b/src/core/utils.js @@ -228,13 +228,13 @@ export function highlight (el) { var reset = function(el) { var text = el.textContent, - pos = 0, // current position + pos = 0, // current position next1 = text[0], // next character - chr = 1, // current character - prev1, // previous character - prev2, // the one before the previous - token = // current token content - el.innerHTML = "", // (and cleaning the node) + chr = 1, // current character + prev1, // previous character + prev2, // the one before the previous + token = // current token content + el.innerHTML = "", // (and cleaning the node) // current token type: // 0: anything else (whitespaces / newlines) @@ -274,11 +274,11 @@ export function highlight (el) { (tokenType > 8 && chr == "\n") || [ // finalize conditions for other token types // 0: whitespaces - /\S/[test](chr), // merged together + /\S/[test](chr), // merged together // 1: operators - 1, // consist of a single character + 1, // consist of a single character // 2: braces - 1, // consist of a single character + 1, // consist of a single character // 3: (key)word !/[$\w]/[test](chr), // 4: regex @@ -341,12 +341,12 @@ export function highlight (el) { // condition) tokenType = 11 while (![ - 1, // 0: whitespace + 1, // 0: whitespace // 1: operator or braces - /[\/{}[(\-+*=<>:;|\\.,?!&@~]/[test](chr), // eslint-disable-line no-useless-escape - /[\])]/[test](chr), // 2: closing brace - /[$\w]/[test](chr), // 3: (key)word - chr == "/" && // 4: regex + /[\/{}[(\-+*=<>:;|\\.,?!&@~]/[test](chr), // eslint-disable-line no-useless-escape + /[\])]/[test](chr), // 2: closing brace + /[$\w]/[test](chr), // 3: (key)word + chr == "/" && // 4: regex // previous token was an // opening brace or an // operator (otherwise @@ -355,13 +355,13 @@ export function highlight (el) { // workaround for xml // closing tags prev1 != "<", - chr == "\"", // 5: string with " - chr == "'", // 6: string with ' + chr == "\"", // 5: string with " + chr == "'", // 6: string with ' // 7: xml comment chr+next1+text[pos+1]+text[pos+2] == "