diff --git a/src/highlight.js b/src/highlight.js index f4f8223a0f..4c9c0658de 100644 --- a/src/highlight.js +++ b/src/highlight.js @@ -192,7 +192,7 @@ https://highlightjs.org/ while (original.length || highlighted.length) { var stream = selectStream(); - result += escape(value.substr(processed, stream[0].offset - processed)); + result += escape(value.substring(processed, stream[0].offset)); processed = stream[0].offset; if (stream === original) { /* @@ -378,7 +378,7 @@ https://highlightjs.org/ match = top.lexemesRe.exec(mode_buffer); while (match) { - result += escape(mode_buffer.substr(last_index, match.index - last_index)); + result += escape(mode_buffer.substring(last_index, match.index)); keyword_match = keywordMatch(top, match); if (keyword_match) { relevance += keyword_match[1]; @@ -515,7 +515,7 @@ https://highlightjs.org/ match = top.terminators.exec(value); if (!match) break; - count = processLexeme(value.substr(index, match.index - index), match[0]); + count = processLexeme(value.substring(index, match.index), match[0]); index = match.index + count; } processLexeme(value.substr(index));