summaryrefslogtreecommitdiffstats
path: root/Lib/xml
diff options
context:
space:
mode:
authorJannis Vajen <jvajen@gmail.com>2022-02-27 14:25:54 (GMT)
committerGitHub <noreply@github.com>2022-02-27 14:25:54 (GMT)
commit345572a1a0263076081020524016eae867677cac (patch)
treebd8a0d74d452e7cc98a111198c7ed24a581255d7 /Lib/xml
parent5a1c637ec6264790d3cfeef46815c62c32b510f3 (diff)
downloadcpython-345572a1a0263076081020524016eae867677cac.zip
cpython-345572a1a0263076081020524016eae867677cac.tar.gz
cpython-345572a1a0263076081020524016eae867677cac.tar.bz2
bpo-46786: Make ElementTree write the HTML tags embed, source, track, wbr as empty tags (GH-31406)
See https://html.spec.whatwg.org/multipage/syntax.html#void-elements for reference.
Diffstat (limited to 'Lib/xml')
-rw-r--r--Lib/xml/etree/ElementTree.py10
1 files changed, 3 insertions, 7 deletions
diff --git a/Lib/xml/etree/ElementTree.py b/Lib/xml/etree/ElementTree.py
index e9409fd..6059e2f 100644
--- a/Lib/xml/etree/ElementTree.py
+++ b/Lib/xml/etree/ElementTree.py
@@ -918,13 +918,9 @@ def _serialize_xml(write, elem, qnames, namespaces,
if elem.tail:
write(_escape_cdata(elem.tail))
-HTML_EMPTY = ("area", "base", "basefont", "br", "col", "frame", "hr",
- "img", "input", "isindex", "link", "meta", "param")
-
-try:
- HTML_EMPTY = set(HTML_EMPTY)
-except NameError:
- pass
+HTML_EMPTY = {"area", "base", "basefont", "br", "col", "embed", "frame", "hr",
+ "img", "input", "isindex", "link", "meta", "param", "source",
+ "track", "wbr"}
def _serialize_html(write, elem, qnames, namespaces, **kwargs):
tag = elem.tag