- Notifications
You must be signed in to change notification settings - Fork294
Open
Labels
Description
I noticed that when serializing an individual element, the lxml serializer continues "past" the element. This causes inconsistent behavior between the "etree" and "lxml" tree types.
A minimal way to reproduce:
def render(html, tree_type): root = html5lib.parseFragment(html, namespaceHTMLElements=False, treebuilder=tree_type) # Get the <b> element. element = root[0][0] print(html5lib.serialize(element, tree=tree_type))html = '<div><b>foo</b></div>'render(html, 'etree')render(html, 'lxml')
Outputs:
<b>foo</b><b>foo</b></div>