Fix HTML 5 parser choking on comments

This commit is contained in:
Kovid Goyal 2012-01-17 22:37:44 +05:30
parent 1a361f694f
commit d6b82e3648

View File

@ -103,7 +103,7 @@ def html5_parse(data, max_nesting_depth=100):
xmlns_declaration = '{%s}'%XMLNS_NS
non_html5_namespaces = {}
seen_namespaces = set()
for elem in tuple(data.iter()):
for elem in tuple(data.iter(tag=etree.Element)):
elem.attrib.pop('xmlns', None)
namespaces = {}
for x in tuple(elem.attrib):