on master help sign in
Make sure slashes get converted first so that they don't get added accidentally for other escaped characters
commit51821fccfd9c91f3756474f1739966fae6a5f1b0 authorEvan Czaplicki <info@elm-lang.org> dateFri 4 Oct 2013, 11:52 (13 years ago) parentf7ef0d8
1 file changed+3−3
libraries/Native/Show.js+3−3
libraries/Native/Show.js+3−3
@@ -80,14 +80,14 @@ Elm.Native.Show.make = function(elm) {
8080 };
8181
8282 function addSlashes(str) {
83− return str.replace(/\n/g, '\\n')
83+ return str.replace(/\\/g, '\\\\')
84+ .replace(/\n/g, '\\n')
8485 .replace(/\t/g, '\\t')
8586 .replace(/\r/g, '\\r')
8687 .replace(/\v/g, '\\v')
8788 .replace(/\0/g, '\\0')
8889 .replace(/\'/g, "\\'")
89− .replace(/\"/g, '\\"')
90− .replace(/\\/g, '\\\\')
90+ .replace(/\"/g, '\\"');
9191 }
9292
9393 return elm.Native.Show.values = { show:toString };