Skip to content

Commit 6ca0244

Browse files
twmambv
andauthored
Support the <wbr> element (#395)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
1 parent 5c30ac3 commit 6ca0244

File tree

4 files changed

+19
-1
lines changed

4 files changed

+19
-1
lines changed

CHANGES.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,23 @@ Change Log
44
1.2
55
~~~
66

7+
Unreleased yet
8+
9+
Features:
10+
11+
* Add support for the ``<wbr>`` element in the sanitizer, `which indicates
12+
a line break opportunity <https://html.spec.whatwg.org/#the-wbr-element>`_.
13+
This element is allowed by default. (#395) (Thank you, Tom Most!)
14+
715
Bug fixes:
816

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

1119
1.1
1220
~~~
1321

22+
Released on June 23, 2020
23+
1424
Breaking changes:
1525

1626
* Drop support for Python 3.3. (#358)

html5lib/constants.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,8 @@
571571
"col",
572572
"input",
573573
"source",
574-
"track"
574+
"track",
575+
"wbr",
575576
])
576577

577578
cdataElements = frozenset(['title', 'textarea'])

html5lib/filters/sanitizer.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@
129129
(namespaces['html'], 'ul'),
130130
(namespaces['html'], 'var'),
131131
(namespaces['html'], 'video'),
132+
(namespaces['html'], 'wbr'),
132133
(namespaces['mathml'], 'maction'),
133134
(namespaces['mathml'], 'math'),
134135
(namespaces['mathml'], 'merror'),

html5lib/tests/test_sanitizer.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ def test_data_uri_disallowed_type():
5555
assert expected == sanitized
5656

5757

58+
def test_wbr_allowed():
59+
sanitized = sanitize_html('<wbr>')
60+
expected = '<wbr/>'
61+
assert expected == sanitized
62+
63+
5864
def param_sanitizer():
5965
for ns, tag_name in sanitizer.allowed_elements:
6066
if ns != constants.namespaces["html"]:

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy