You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As far as I understand according to #228 the preparation code output should be stripped of any and all <script> tags, yet it only strips the first script tag it finds. This is due to String.prototype.replace() stopping after the first match unless a RegExp with the global flag is used.
However due to #236, being unable to edit tests, I can't really give any neat live examples.
As a side note; highlight.js 9.12.0 (and apparently the version used in jsPerf) automatically highlights javascript inside HTML-code, so the special code for swapping for @jsPerfTagToken back and forth is not really required (though I guess it doesn't really hurt). This is also the reason the code "works", because highlight.js is masking the fact that only the content of the first <script> tag is explicitly highlighted.
The text was updated successfully, but these errors were encountered:
As far as I understand according to #228 the preparation code output should be stripped of any and all
<script>
tags, yet it only strips the first script tag it finds. This is due to String.prototype.replace() stopping after the first match unless a RegExp with the global flag is used.However due to #236, being unable to edit tests, I can't really give any neat live examples.
Regex definition is here:
jsperf.com/server/lib/regex.js
Line 88 in f61045f
RegEx instantiation and replacing is here:
jsperf.com/server/web/test/index.js
Lines 26 to 27 in f61045f
I.e. this RegEx():
Should have the global (g) flag as well:
These lines will also be affected (a good thing):
jsperf.com/server/web/test/index.js
Lines 33 to 34 in f61045f
And last but not least, this line should have the global flag as well, for the same reasons:
jsperf.com/server/web/test/index.js
Line 45 in f61045f
As a side note; highlight.js 9.12.0 (and apparently the version used in jsPerf) automatically highlights javascript inside HTML-code, so the special code for swapping for
@jsPerfTagToken
back and forth is not really required (though I guess it doesn't really hurt). This is also the reason the code "works", because highlight.js is masking the fact that only the content of the first<script>
tag is explicitly highlighted.The text was updated successfully, but these errors were encountered: