Skip to content

Commit

Permalink
Support the <wbr> element (#395)
Browse files Browse the repository at this point in the history
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
  • Loading branch information
twm and ambv committed Mar 2, 2023
1 parent 5c30ac3 commit 6ca0244
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 1 deletion.
10 changes: 10 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,23 @@ Change Log
1.2
~~~

Unreleased yet

Features:

* Add support for the ``<wbr>`` element in the sanitizer, `which indicates
a line break opportunity <https://html.spec.whatwg.org/#the-wbr-element>`_.
This element is allowed by default. (#395) (Thank you, Tom Most!)

Bug fixes:

* The sanitizer now permits ``<summary>`` tags.

1.1
~~~

Released on June 23, 2020

Breaking changes:

* Drop support for Python 3.3. (#358)
Expand Down
3 changes: 2 additions & 1 deletion html5lib/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,8 @@
"col",
"input",
"source",
"track"
"track",
"wbr",
])

cdataElements = frozenset(['title', 'textarea'])
Expand Down
1 change: 1 addition & 0 deletions html5lib/filters/sanitizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@
(namespaces['html'], 'ul'),
(namespaces['html'], 'var'),
(namespaces['html'], 'video'),
(namespaces['html'], 'wbr'),
(namespaces['mathml'], 'maction'),
(namespaces['mathml'], 'math'),
(namespaces['mathml'], 'merror'),
Expand Down
6 changes: 6 additions & 0 deletions html5lib/tests/test_sanitizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ def test_data_uri_disallowed_type():
assert expected == sanitized


def test_wbr_allowed():
sanitized = sanitize_html('<wbr>')
expected = '<wbr/>'
assert expected == sanitized


def param_sanitizer():
for ns, tag_name in sanitizer.allowed_elements:
if ns != constants.namespaces["html"]:
Expand Down

0 comments on commit 6ca0244

Please sign in to comment.