Commit ab9b661f authored by Ezio Melotti's avatar Ezio Melotti

#15970: merge with 3.2.

parents da064d07 c90111f9
......@@ -1809,6 +1809,18 @@ class ElementTreeTest(unittest.TestCase):
mye = MyElement('joe')
self.assertEqual(mye.newmethod(), 'joe')
def test_html_empty_elems_serialization(self):
# issue 15970
# from http://www.w3.org/TR/html401/index/elements.html
for element in ['AREA', 'BASE', 'BASEFONT', 'BR', 'COL', 'FRAME', 'HR',
'IMG', 'INPUT', 'ISINDEX', 'LINK', 'META', 'PARAM']:
for elem in [element, element.lower()]:
expected = '<%s>' % elem
serialized = serialize(ET.XML('<%s />' % elem), method='html')
self.assertEqual(serialized, expected)
serialized = serialize(ET.XML('<%s></%s>' % (elem,elem)),
method='html')
self.assertEqual(serialized, expected)
class ElementIterTest(unittest.TestCase):
def _ilist(self, elem, tag=None):
......
......@@ -995,7 +995,7 @@ def _serialize_xml(write, elem, qnames, namespaces):
write(_escape_cdata(elem.tail))
HTML_EMPTY = ("area", "base", "basefont", "br", "col", "frame", "hr",
"img", "input", "isindex", "link", "meta" "param")
"img", "input", "isindex", "link", "meta", "param")
try:
HTML_EMPTY = set(HTML_EMPTY)
......
......@@ -32,6 +32,9 @@ Core and Builtins
Library
-------
- Issue #15970: xml.etree.ElementTree now serializes correctly the empty HTML
elements 'meta' and 'param'.
- Issue #15842: the SocketIO.{readable,writable,seekable} methods now
raise ValueError when the file-like object is closed. Patch by Alessandro
Moura.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment