Element <sup> loses its parent in html

Bug #2023309 reported by Alexey Sokirko
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
lxml
New
Undecided
Unassigned

Bug Description

Element <sup> loses its parent

=====================

import lxml.html

html = """
<html>
<body>
    <p>
        <div> </div>
        <sup>test</sup>
    </p>
</body>
</html>
"""

def main():
    node = lxml.html.fromstring(html)
    html_out = lxml.etree.tostring(node, method='html').decode()
    print(html_out)

if __name__ == '__main__':
    main()

==================
Output
<html>
<body>
    <p> </p>
    <div> </div>
    <sup>test</sup>

</body>
</html>

=====================
Python : sys.version_info(major=3, minor=10, micro=6, releaselevel='final', serial=0)
lxml.etree : (4, 8, 0, 0)
libxml used : (2, 9, 12)
libxml compiled : (2, 9, 12)
libxslt used : (1, 1, 34)
libxslt compiled : (1, 1, 34)

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.