summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--django/test/html.py11
-rw-r--r--tests/test_utils/tests.py10
2 files changed, 13 insertions, 8 deletions
diff --git a/django/test/html.py b/django/test/html.py
index b238fd48d9..511c08bb26 100644
--- a/django/test/html.py
+++ b/django/test/html.py
@@ -141,10 +141,13 @@ class HTMLParseError(Exception):
class Parser(HTMLParser):
- SELF_CLOSING_TAGS = (
- 'br', 'hr', 'input', 'img', 'meta', 'spacer', 'link', 'frame', 'base',
- 'col',
- )
+ # https://html.spec.whatwg.org/#void-elements
+ SELF_CLOSING_TAGS = {
+ 'area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'link', 'meta',
+ 'param', 'source', 'track', 'wbr',
+ # Deprecated tags
+ 'frame', 'spacer',
+ }
def __init__(self):
super().__init__()
diff --git a/tests/test_utils/tests.py b/tests/test_utils/tests.py
index 2697590b77..f07c0dcd53 100644
--- a/tests/test_utils/tests.py
+++ b/tests/test_utils/tests.py
@@ -537,10 +537,12 @@ class HTMLEqualTests(SimpleTestCase):
self.assertEqual(dom.children[0], "<p>foo</p> '</scr'+'ipt>' <span>bar</span>")
def test_self_closing_tags(self):
- self_closing_tags = (
- 'br', 'hr', 'input', 'img', 'meta', 'spacer', 'link', 'frame',
- 'base', 'col',
- )
+ self_closing_tags = [
+ 'area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'link',
+ 'meta', 'param', 'source', 'track', 'wbr',
+ # Deprecated tags
+ 'frame', 'spacer',
+ ]
for tag in self_closing_tags:
with self.subTest(tag):
dom = parse_html('<p>Hello <%s> world</p>' % tag)