From 63e631ebd34f40d702adfb61fe00a5c9631ba443 Mon Sep 17 00:00:00 2001 From: Morgan Klonteig Date: Thu, 21 Nov 2024 20:46:53 -0800 Subject: [PATCH] feat: Add CSS direction support (#429) --- library/HTMLPurifier/CSSDefinition.php | 5 +++++ tests/HTMLPurifier/AttrDef/CSSTest.php | 2 ++ 2 files changed, 7 insertions(+) diff --git a/library/HTMLPurifier/CSSDefinition.php b/library/HTMLPurifier/CSSDefinition.php index 3732c076..923d6f3d 100644 --- a/library/HTMLPurifier/CSSDefinition.php +++ b/library/HTMLPurifier/CSSDefinition.php @@ -26,6 +26,11 @@ class HTMLPurifier_CSSDefinition extends HTMLPurifier_Definition false ); + $this->info['direction'] = new HTMLPurifier_AttrDef_Enum( + ['ltr', 'rtl'], + false + ); + $border_style = $this->info['border-bottom-style'] = $this->info['border-right-style'] = diff --git a/tests/HTMLPurifier/AttrDef/CSSTest.php b/tests/HTMLPurifier/AttrDef/CSSTest.php index 82e07bb6..049c56a5 100644 --- a/tests/HTMLPurifier/AttrDef/CSSTest.php +++ b/tests/HTMLPurifier/AttrDef/CSSTest.php @@ -13,6 +13,8 @@ class HTMLPurifier_AttrDef_CSSTest extends HTMLPurifier_AttrDefHarness { // regular cases, singular $this->assertDef('text-align:right;'); + $this->assertDef('direction:ltr;'); + $this->assertDef('direction:rtl;'); $this->assertDef('border-left-style:solid;'); $this->assertDef('border-style:solid dotted;'); $this->assertDef('clear:right;');