Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(javascript) comma is allowed in a "value container" (#2403)
- fixes case where a regex would not be detected if it was anything other than the first parameter of a function call - in some cases this could actually cause the whole snippet to be flagged as illegal if the regex contained characters that were invalid at the top level (such as #) This complexity is because we only detect regexs inside "value containers" to prevent false positivies. This issue was found when asking Highlight.js to highlight it's own non-minified 1.2mb browser build.
- Loading branch information
1 parent
65d46b3
commit 4bc39be
Showing
4 changed files
with
16 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,6 @@ | ||
x.continue(<span class="hljs-number">0</span>); | ||
|
||
x = [ | ||
hljs.COMMENT(<span class="hljs-regexp">/\{%\s*comment\s*%}/</span>, <span class="hljs-regexp">/\{%\s*endcomment\s*%}/</span>), | ||
hljs.COMMENT(<span class="hljs-regexp">/\{#/</span>, <span class="hljs-regexp">/#}/</span>), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,7 @@ | ||
x.continue(0); | ||
|
||
x = [ | ||
hljs.COMMENT(/\{%\s*comment\s*%}/, /\{%\s*endcomment\s*%}/), | ||
hljs.COMMENT(/\{#/, /#}/), | ||
] | ||
|