From 91c7979b6d90dfd3e9cd1d3e90b2d95112d174e2 Mon Sep 17 00:00:00 2001 From: mscherer Date: Sat, 6 Dec 2025 03:36:45 +0100 Subject: [PATCH] Add support for reversed and start attributes on ol elements Move the start attribute from Legacy module to the core List module and add the reversed boolean attribute. Both are standard HTML5 attributes and should be available by default. Fixes #468 --- library/HTMLPurifier/HTMLModule/Legacy.php | 1 - library/HTMLPurifier/HTMLModule/List.php | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/library/HTMLPurifier/HTMLModule/Legacy.php b/library/HTMLPurifier/HTMLModule/Legacy.php index 86b529957..5f72206ad 100644 --- a/library/HTMLPurifier/HTMLModule/Legacy.php +++ b/library/HTMLPurifier/HTMLModule/Legacy.php @@ -131,7 +131,6 @@ public function setup($config) $ol = $this->addBlankElement('ol'); $ol->attr['compact'] = 'Bool#compact'; - $ol->attr['start'] = new HTMLPurifier_AttrDef_Integer(); $ol->attr['type'] = 'Enum#s:1,i,I,a,A'; $p = $this->addBlankElement('p'); diff --git a/library/HTMLPurifier/HTMLModule/List.php b/library/HTMLPurifier/HTMLModule/List.php index 7a20ff701..2968e05f6 100644 --- a/library/HTMLPurifier/HTMLModule/List.php +++ b/library/HTMLPurifier/HTMLModule/List.php @@ -30,6 +30,8 @@ class HTMLPurifier_HTMLModule_List extends HTMLPurifier_HTMLModule public function setup($config) { $ol = $this->addElement('ol', 'List', new HTMLPurifier_ChildDef_List(), 'Common'); + $ol->attr['reversed'] = 'Bool#reversed'; + $ol->attr['start'] = new HTMLPurifier_AttrDef_Integer(); $ul = $this->addElement('ul', 'List', new HTMLPurifier_ChildDef_List(), 'Common'); // XXX The wrap attribute is handled by MakeWellFormed. This is all // quite unsatisfactory, because we generated this