html5lib example in docs does not work as stated

Bug #1483006 reported by Chris Jerdonek on 2015-08-09
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
lxml
Undecided
Unassigned

Bug Description

The lxml docs show the following example:

    >>> from lxml.html import tostring, html5parser
    >>> tostring(html5parser.fromstring("<table><td>foo"))
    '<table><tbody><tr><td>foo</td></tr></tbody></table>'

(from http://lxml.de/html5parser.html#differences-to-regular-html-parsing )

However, when I run the example myself I get the following:

    >>> from lxml.html import tostring, html5parser
    >>> tostring(html5parser.fromstring("<table><td>foo"))
    b'<html:table xmlns:html="http://www.w3.org/1999/xhtml"><html:tbody><html:tr><html:td>foo</html:td></html:tr></html:tbody></html:table>'

I am using the newest versions of lxml and html5lib installed from pip:

Python : sys.version_info(major=3, minor=4, micro=3, releaselevel='final', serial=0)
lxml.etree : (3, 4, 4, 0)
libxml used : (2, 9, 2)
libxml compiled : (2, 9, 2)
libxslt used : (1, 1, 28)
libxslt compiled : (1, 1, 28)
html5lib==0.999999

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

Other bug subscribers