-
Notifications
You must be signed in to change notification settings - Fork 257
Closed
Description
The <wbr> element is balanced by bleach.clean even though it is an empty element.
Using the list of empty tags from MDN:
In [6]: empty_elements = {
...: 'area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'meta', 'param', 'source', 'track', 'wbr'
...: }
In [7]: html = "".join("<%s>" % s for s in empty_elements)
In [8]: import bleach
In [9]: bleach.clean(html, tags=empty_elements)
Out[9]: '<param><source><hr><base><track><area><wbr></wbr><br><img><keygen></keygen><link><input><meta><embed>'
The output includes <wbr></wbr> when it should just be <wbr> like the others. keygen has the same problem, but that's deprecated so I'm not sure if it's worth including.