Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion django/utils/html.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
from django.utils.safestring import SafeData, SafeString, mark_safe
from django.utils.text import normalize_newlines

_strip_spaces_pattern = re.compile(r">\s+<")

# https://html.spec.whatwg.org/#void-elements
VOID_ELEMENTS = frozenset(
(
Expand Down Expand Up @@ -232,7 +234,7 @@ def strip_tags(value):
@keep_lazy_text
def strip_spaces_between_tags(value):
"""Return the given HTML with spaces between tags removed."""
return re.sub(r">\s+<", "><", str(value))
return _strip_spaces_pattern.sub("><", str(value))


def smart_urlquote(url):
Expand Down