webelem: Escape \r in javascript_escape().

This commit is contained in:
Florian Bruhin 2015-08-03 23:22:23 +02:00
parent 8011cefea6
commit ed4fc4d1ba

View File

@ -310,6 +310,7 @@ def javascript_escape(text):
("'", r"\'"), # Then escape ' and " as \' and \".
('"', r'\"'), # (note it won't hurt when we escape the wrong one).
('\n', r'\n'), # We also need to escape newlines for some reason.
('\r', r'\r'),
)
for orig, repl in replacements:
text = text.replace(orig, repl)