diff --git a/core/lib/Drupal/Component/Utility/Xss.php b/core/lib/Drupal/Component/Utility/Xss.php
index 8d0d257..6878081 100644
--- a/core/lib/Drupal/Component/Utility/Xss.php
+++ b/core/lib/Drupal/Component/Utility/Xss.php
@@ -54,8 +54,6 @@ public static function filter($string, $allowed_tags = array('a', 'em', 'strong'
     if (!Unicode::validateUtf8($string)) {
       return '';
     }
-    // Store the text format.
-    static::split($allowed_tags, TRUE);
     // Remove NULL characters (ignored by some browsers).
     $string = str_replace(chr(0), '', $string);
     // Remove Netscape 4 JS entities.
@@ -70,7 +68,11 @@ public static function filter($string, $allowed_tags = array('a', 'em', 'strong'
     $string = preg_replace('/&amp;#[Xx]0*((?:[0-9A-Fa-f]{2})+;)/', '&#x\1', $string);
     // Named entities.
     $string = preg_replace('/&amp;([A-Za-z][A-Za-z0-9]*;)/', '&\1', $string);
-
+    $allowed_tags = array_flip($allowed_tags);
+    $class = get_called_class();
+    $splitter = function ($matches) use ($allowed_tags, $class) {
+      return $class::split($matches, $allowed_tags);
+    };
     return preg_replace_callback('%
       (
       <(?=[^a-zA-Z!/])  # a lone <
@@ -80,7 +82,7 @@ public static function filter($string, $allowed_tags = array('a', 'em', 'strong'
       <[^>]*(>|$)       # a string that starts with a <, up until the > or the end of the string
       |                 # or
       >                 # just a >
-      )%x', '\Drupal\Component\Utility\Xss::split', $string);
+      )%x', $splitter, $string);
   }
 
   /**
@@ -106,25 +108,22 @@ public static function filterAdmin($string) {
   /**
    * Processes an HTML tag.
    *
+   * Call \Drupal\Component\Xss\filter() instead of this helper.
+   *
    * @param array $matches
    *   An array with various meaning depending on the value of $store.
    *   If $store is TRUE then the array contains the allowed tags.
-   *   If $store is FALSE then the array has one element, the HTML tag to process.
-   * @param bool $store
-   *   Whether to store $m.
+   *   If $store is FALSE then the array has one element, the HTML tag to
+   *   process.
+   * @param array $allowed_tags
+   *   An array where the keys are the allowed tags and the values are not
+   *   used.
    *
    * @return string
    *   If the element isn't allowed, an empty string. Otherwise, the cleaned up
    *   version of the HTML element.
    */
-  protected static function split($matches, $store = FALSE) {
-    static $allowed_html;
-
-    if ($store) {
-      $allowed_html = array_flip($matches);
-      return;
-    }
-
+  public static function split($matches, $allowed_tags) {
     $string = $matches[1];
 
     if (substr($string, 0, 1) != '<') {
@@ -150,7 +149,7 @@ protected static function split($matches, $store = FALSE) {
       $elem = '!--';
     }
 
-    if (!isset($allowed_html[strtolower($elem)])) {
+    if (!isset($allowed_tags[strtolower($elem)])) {
       // Disallowed HTML element.
       return '';
     }
