From 6392bf26caa1ad4675152491bb2e19896e1d41c5 Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Sat, 4 Mar 2017 09:04:16 -0500 Subject: [PATCH] [1.11.x] Fixed #27900 -- Made escapejs escape backticks for use in ES6 template literals. Backport of 6ae1b04fb584db0fdb22b8e287784c4ed3ac62ac from master --- django/utils/html.py | 1 + tests/utils_tests/test_html.py | 1 + 2 files changed, 2 insertions(+) diff --git a/django/utils/html.py b/django/utils/html.py index ff9adffc75..9a968a5a41 100644 --- a/django/utils/html.py +++ b/django/utils/html.py @@ -61,6 +61,7 @@ _js_escapes = { ord('='): '\\u003D', ord('-'): '\\u002D', ord(';'): '\\u003B', + ord('`'): '\\u0060', ord('\u2028'): '\\u2028', ord('\u2029'): '\\u2029' } diff --git a/tests/utils_tests/test_html.py b/tests/utils_tests/test_html.py index 39d590032f..7982f4fe42 100644 --- a/tests/utils_tests/test_html.py +++ b/tests/utils_tests/test_html.py @@ -142,6 +142,7 @@ class TestUtilsHtml(SimpleTestCase): 'paragraph separator:\u2029and line separator:\u2028', 'paragraph separator:\\u2029and line separator:\\u2028' ), + ('`', '\\u0060'), ) for value, output in items: self.check_output(f, value, output)