diff --git a/core/lib/Drupal/Component/Utility/Html.php b/core/lib/Drupal/Component/Utility/Html.php index 00e9016..b735fd3 100644 --- a/core/lib/Drupal/Component/Utility/Html.php +++ b/core/lib/Drupal/Component/Utility/Html.php @@ -85,11 +85,12 @@ public static function cleanCssIdentifier($identifier, array $filter = array( // We could also use strtr() here but its much slower than str_replace(). In // order to keep '__' to stay '__' we first replace it with a different // placeholder after checking that it is not defined as a filter. + $double_underscore_replacements = 0; if (!isset($filter['__'])) { - $identifier = str_replace('__', '##', $identifier); + $identifier = str_replace('__', '##', $identifier, $double_underscore_replacements); } $identifier = str_replace(array_keys($filter), array_values($filter), $identifier); - if (!isset($filter['__'])) { + if (!isset($filter['__']) && $double_underscore_replacements > 0) { $identifier = str_replace('##', '__', $identifier); }