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

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

View File

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