diff --git a/lib/loofah/helpers.rb b/lib/loofah/helpers.rb index 17400b17..4cdfa3a3 100644 --- a/lib/loofah/helpers.rb +++ b/lib/loofah/helpers.rb @@ -95,7 +95,9 @@ def sanitize_css style_string, *args end WhiteListSanitizer = SafeListSanitizer - deprecate_constant :WhiteListSanitizer + if Object.respond_to?(:deprecate_constant) + deprecate_constant :WhiteListSanitizer + end end end end diff --git a/lib/loofah/html5/safelist.rb b/lib/loofah/html5/safelist.rb index 3144d352..558dea9c 100644 --- a/lib/loofah/html5/safelist.rb +++ b/lib/loofah/html5/safelist.rb @@ -787,7 +787,9 @@ module SafeList end WhiteList = SafeList - deprecate_constant :WhiteList + if Object.respond_to?(:deprecate_constant) + deprecate_constant :WhiteList + end ::Loofah::MetaHelpers.add_downcased_set_members_to_all_set_constants ::Loofah::HTML5::SafeList end