From 2d72f22832a8d7888d516f7998539a5124571cf4 Mon Sep 17 00:00:00 2001 From: Tom Most Date: Sat, 9 Jun 2018 17:46:50 -0700 Subject: [PATCH 1/2] Support the element --- CHANGES.rst | 9 +++++++++ html5lib/constants.py | 3 ++- html5lib/filters/sanitizer.py | 1 + html5lib/tests/test_sanitizer.py | 6 ++++++ 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index 82605a21..be3fdb7c 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,6 +1,15 @@ Change Log ---------- +1.1.0 +~~~~~ + +Features: + +* Add support for the ```` element, `which indicates a line break + opportunity `_. This element + is allowed by default by the sanitizer. (#395) (Thank you, Tom Most!) + 1.0.1 ~~~~~ diff --git a/html5lib/constants.py b/html5lib/constants.py index 1ff80419..0a0a4887 100644 --- a/html5lib/constants.py +++ b/html5lib/constants.py @@ -572,7 +572,8 @@ "col", "input", "source", - "track" + "track", + "wbr", ]) cdataElements = frozenset(['title', 'textarea']) diff --git a/html5lib/filters/sanitizer.py b/html5lib/filters/sanitizer.py index e852f53b..302c2a5d 100644 --- a/html5lib/filters/sanitizer.py +++ b/html5lib/filters/sanitizer.py @@ -111,6 +111,7 @@ (namespaces['html'], 'ul'), (namespaces['html'], 'var'), (namespaces['html'], 'video'), + (namespaces['html'], 'wbr'), (namespaces['mathml'], 'maction'), (namespaces['mathml'], 'math'), (namespaces['mathml'], 'merror'), diff --git a/html5lib/tests/test_sanitizer.py b/html5lib/tests/test_sanitizer.py index 45046d57..33270a80 100644 --- a/html5lib/tests/test_sanitizer.py +++ b/html5lib/tests/test_sanitizer.py @@ -59,6 +59,12 @@ def test_data_uri_disallowed_type(): assert expected == sanitized +def test_wbr_allowed(): + sanitized = sanitize_html('') + expected = '' + assert expected == sanitized + + def test_sanitizer(): for ns, tag_name in sanitizer.allowed_elements: if ns != constants.namespaces["html"]: From 08966bb48c18d8b90d0b1ec66d55710c7b53d23b Mon Sep 17 00:00:00 2001 From: Tom Most Date: Sat, 27 Jun 2020 14:15:06 -0700 Subject: [PATCH 2/2] Fix lint --- html5lib/tests/test_sanitizer.py | 1 - 1 file changed, 1 deletion(-) diff --git a/html5lib/tests/test_sanitizer.py b/html5lib/tests/test_sanitizer.py index 8ce33055..c3a7e404 100644 --- a/html5lib/tests/test_sanitizer.py +++ b/html5lib/tests/test_sanitizer.py @@ -56,7 +56,6 @@ def test_wbr_allowed(): assert expected == sanitized - def param_sanitizer(): for ns, tag_name in sanitizer.allowed_elements: if ns != constants.namespaces["html"]: