diff --git a/core/lib/Drupal/Component/Utility/Html.php b/core/lib/Drupal/Component/Utility/Html.php
index f9bb8e6a23..8c7d3888cd 100644
--- a/core/lib/Drupal/Component/Utility/Html.php
+++ b/core/lib/Drupal/Component/Utility/Html.php
@@ -286,7 +286,7 @@ public static function load($html) {
 
     $dom = new \DOMDocument();
     // Ignore warnings during HTML soup loading.
-    @$dom->loadHTML($document);
+    @$dom->loadHTML($document, LIBXML_NOBLANKS);
 
     return $dom;
   }
