From e286af5b2d7d6d14bb10946448b4a92cf045d221 Mon Sep 17 00:00:00 2001 From: Hannes Date: Fri, 21 May 2021 21:51:31 +0200 Subject: [PATCH] feat: Allow to disable the var matcher --- extension.json | 4 ++++ includes/Hooks/StylesheetSanitizerHook.php | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/extension.json b/extension.json index 38d485c..b985bc7 100644 --- a/extension.json +++ b/extension.json @@ -21,6 +21,10 @@ "TemplateStylesExtenderEnablePrefersColorScheme": { "description": "Enable the prefers-color-scheme media query. WARNING this can break things if TemplateStyles was updated upstream", "value": true + }, + "TemplateStylesExtenderEnableCssVars": { + "description": "Enable the matcher for css variables", + "value": true } }, "MessagesDirs": { diff --git a/includes/Hooks/StylesheetSanitizerHook.php b/includes/Hooks/StylesheetSanitizerHook.php index d272208..f90b19a 100644 --- a/includes/Hooks/StylesheetSanitizerHook.php +++ b/includes/Hooks/StylesheetSanitizerHook.php @@ -56,10 +56,15 @@ class StylesheetSanitizerHook { $extender = new StylePropertySanitizerExtender( $matcherFactory ); - $extended->addVarSelector( $propertySanitizer, $matcherFactory ); + if ( TemplateStylesExtender::getConfigValue( + 'TemplateStylesExtenderEnableCssVars', + true ) === true ) { + $extended->addVarSelector( $propertySanitizer, $matcherFactory ); + } $extended->addImageRendering( $extender ); $extended->addRuby( $extender ); + $extended->addPointerEvents( $extender ); $extended->addScrollMarginProperties( $extender, $matcherFactory ); $propertySanitizer->setKnownProperties( $extender->getKnownProperties() );