<source> and <track> are void elements in HTML 5

Bug #1758553 reported by Vincent Bernat
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
lxml
Fix Released
Undecided
scoder

Bug Description

Hey!

In HTML5, the void elements are listed here: https://www.w3.org/TR/html5/syntax.html#void-elements. This doesn't match the list in src/lxml/html/defs.py. Notably, <source> and <track> are in html5_tags instead.

Revision history for this message
scoder (scoder) wrote :
Changed in lxml:
assignee: nobody → scoder (scoder)
milestone: none → 4.4.0
status: New → Fix Committed
scoder (scoder)
Changed in lxml:
status: Fix Committed → Fix Released
Revision history for this message
Vincent Bernat (vbernat) wrote :

Hey!

Sorry for not testing earlier, but it doesn't seem to work:

```
>>> from lxml import etree as ET
>>> import lxml.html
>>> lxml.html.tostring(ET.Element("source"))
'<source></source>'
>>> lxml.html.tostring(ET.Element("img"))
'<img>'
```

Maybe these tags should be removed from `html5_tags`? All other tags from `empty_tags` are part of another set. Dunno, if this is mandatory.

Revision history for this message
scoder (scoder) wrote :

The serialisation is done by libxml2. defs.py is mostly used by the cleaner and for informational purposes, not for serialisation.

Revision history for this message
Vincent Bernat (vbernat) wrote :

Thanks, I will push a similar fix to libxml2 then!

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.