N°5793 - HTML Sanitizer: Allow 'start' attribute in 'ol' tag (#368)

* * Extended allowed attributes on ol, li (based on W3Schools)

* Change unit test case label

Co-authored-by: Molkobain <lajarige.guillaume@free.fr>
This commit is contained in:
jbostoen
2022-12-14 15:46:59 +01:00
committed by GitHub
parent fe997d1254
commit 32ee1a8226
2 changed files with 10 additions and 4 deletions

View File

@@ -286,8 +286,8 @@ class HTMLDOMSanitizer extends DOMSanitizer
'strong' => array(),
'img' => array('src', 'style', 'alt', 'title'),
'ul' => array('style'),
'ol' => array('style'),
'li' => array('style'),
'ol' => array('reversed', 'start', 'style', 'type'),
'li' => array('style', 'value'),
'h1' => array('style'),
'h2' => array('style'),
'h3' => array('style'),

View File

@@ -86,8 +86,8 @@ class HTMLDOMSanitizerTest extends AbstractDOMSanitizerTest
'strong' => array(),
'img' => array('src', 'style', 'alt', 'title'),
'ul' => array('style'),
'ol' => array('style'),
'li' => array('style'),
'ol' => array('reversed', 'start', 'style', 'type'),
'li' => array('style', 'value'),
'h1' => array('style'),
'h2' => array('style'),
'h3' => array('style'),
@@ -213,6 +213,12 @@ class HTMLDOMSanitizerTest extends AbstractDOMSanitizerTest
'html' => '<html><head></head><body lang="EN-GB" link="#0563C1" vlink="#954F72">bar</body></html>',
'expected' => 'bar',
),
'ordered list with attributes' => array(
'html' => '<ol start="100" reversed="reversed" type="I" baz="1" biz="2"><li value="101" baz="1" biz="2">Some list item</li></ol>',
'expected' => '<ol start="100" reversed="reversed" type="I"><li value="101">Some list item</li></ol>',
),
);
}