JavaScript: Deal with (un-)escaping on captured variables.

This commit is contained in:
Max Schaefer
2019-10-30 14:46:50 +00:00
parent a8214ce7ee
commit 8c133ff61d
2 changed files with 13 additions and 1 deletions

View File

@@ -123,3 +123,10 @@ function roundtrip(s) {
function badRoundtrip(s) {
return s.replace(/\\\\/g, "\\").replace(/\\/g, "\\\\");
}
function testWithCapturedVar(x) {
var captured = x;
(function() {
captured = captured.replace(/\\/g, "\\\\");
})();
}