diff --git a/core/lib/Drupal/Core/Render/Element/HtmlTag.php b/core/lib/Drupal/Core/Render/Element/HtmlTag.php
index 1d71350..ebb4ff4 100644
--- a/core/lib/Drupal/Core/Render/Element/HtmlTag.php
+++ b/core/lib/Drupal/Core/Render/Element/HtmlTag.php
@@ -87,13 +87,13 @@ public static function preRenderHtmlTag($element) {
     $markup = '<' . $escaped_tag . $attributes;
     // Construct a void element.
     if (in_array($element['#tag'], self::$voidElements)) {
-      $markup .= " />\n";
+      $markup .= " />";
     }
     // Construct all other elements.
     else {
       $markup .= '>';
       $markup .= $element['#value'] instanceof MarkupInterface ? $element['#value'] : Xss::filterAdmin($element['#value']);
-      $markup .= '</' . $escaped_tag . ">\n";
+      $markup .= '</' . $escaped_tag . ">";
     }
     if (!empty($element['#noscript'])) {
       $markup = "<noscript>$markup</noscript>";
diff --git a/core/modules/big_pipe/src/Tests/BigPipePlaceholderTestCases.php b/core/modules/big_pipe/src/Tests/BigPipePlaceholderTestCases.php
index 1cf10d4..17a19d9 100644
--- a/core/modules/big_pipe/src/Tests/BigPipePlaceholderTestCases.php
+++ b/core/modules/big_pipe/src/Tests/BigPipePlaceholderTestCases.php
@@ -104,7 +104,7 @@ public static function cases(ContainerInterface $container = NULL, AccountInterf
         ],
         [
           'command' => 'add_css',
-          'data' => '<link rel="stylesheet" href="' . base_path() . 'core/themes/classy/css/components/messages.css?' . $container->get('state')->get('system.css_js_query_string') . '" media="all" />' . "\n"
+          'data' => '<link rel="stylesheet" href="' . base_path() . 'core/themes/classy/css/components/messages.css?' . $container->get('state')->get('system.css_js_query_string') . '" media="all" />'
         ],
         [
           'command' => 'insert',
@@ -114,7 +114,7 @@ public static function cases(ContainerInterface $container = NULL, AccountInterf
           'settings' => NULL,
         ],
       ];
-      $status_messages->embeddedHtmlResponse = '<link rel="stylesheet" href="' . base_path() . 'core/themes/classy/css/components/messages.css?' . $container->get('state')->get('system.css_js_query_string') . '" media="all" />' . "\n" . "\n" . '    <div role="contentinfo" aria-label="Status message" class="messages messages--status">' . "\n" . '                  <h2 class="visually-hidden">Status message</h2>' . "\n" . '                    Hello from BigPipe!' . "\n" . '            </div>' . "\n    \n";
+      $status_messages->embeddedHtmlResponse = '<link rel="stylesheet" href="' . base_path() . 'core/themes/classy/css/components/messages.css?' . $container->get('state')->get('system.css_js_query_string') . '" media="all" />' . "\n" . '    <div role="contentinfo" aria-label="Status message" class="messages messages--status">' . "\n" . '                  <h2 class="visually-hidden">Status message</h2>' . "\n" . '                    Hello from BigPipe!' . "\n" . '            </div>' . "\n    \n";
     }
 
 
diff --git a/core/modules/big_pipe/src/Tests/BigPipeTest.php b/core/modules/big_pipe/src/Tests/BigPipeTest.php
index f947c46..f44e7c0 100644
--- a/core/modules/big_pipe/src/Tests/BigPipeTest.php
+++ b/core/modules/big_pipe/src/Tests/BigPipeTest.php
@@ -86,7 +86,7 @@ public function testNoJsDetection() {
     $this->drupalLogin($this->rootUser);
     $this->assertSessionCookieExists(TRUE);
     $this->assertBigPipeNoJsCookieExists(FALSE);
-    $this->assertRaw('<noscript><meta http-equiv="Refresh" content="0; URL=' . base_path() . 'big_pipe/no-js?destination=' . base_path() . 'user/1" />' . "\n" . '</noscript>');
+    $this->assertRaw('<noscript><meta http-equiv="Refresh" content="0; URL=' . base_path() . 'big_pipe/no-js?destination=' . base_path() . 'user/1" /></noscript>');
     $this->assertNoRaw($no_js_to_js_markup);
     $this->assertBigPipeNoJsMetaRefreshRedirect();
     $this->assertBigPipeNoJsCookieExists(TRUE);
@@ -104,7 +104,7 @@ public function testNoJsDetection() {
     $this->drupalGet(Url::fromRoute('user.login'));
     $this->assertSessionCookieExists(TRUE);
     $this->assertBigPipeNoJsCookieExists(FALSE);
-    $this->assertRaw('<noscript><meta http-equiv="Refresh" content="0; URL=' . base_path() . 'big_pipe/no-js?destination=' . base_path() . 'user/login" />' . "\n" . '</noscript>');
+    $this->assertRaw('<noscript><meta http-equiv="Refresh" content="0; URL=' . base_path() . 'big_pipe/no-js?destination=' . base_path() . 'user/login" /></noscript>');
     $this->assertNoRaw($no_js_to_js_markup);
     $this->assertBigPipeNoJsMetaRefreshRedirect();
     $this->assertBigPipeNoJsCookieExists(TRUE);
diff --git a/core/modules/system/src/Tests/Common/AttachedAssetsTest.php b/core/modules/system/src/Tests/Common/AttachedAssetsTest.php
index 8074669..27dbc20 100644
--- a/core/modules/system/src/Tests/Common/AttachedAssetsTest.php
+++ b/core/modules/system/src/Tests/Common/AttachedAssetsTest.php
@@ -261,8 +261,8 @@ function testBrowserConditionalComments() {
     $js = $this->assetResolver->getJsAssets($assets, FALSE)[1];
     $js_render_array = \Drupal::service('asset.js.collection_renderer')->render($js);
     $rendered_js = $this->renderer->renderPlain($js_render_array);
-    $expected_1 = "<!--[if lte IE 8]>\n" . '<script src="' . file_url_transform_relative(file_create_url('core/modules/system/tests/modules/common_test/old-ie.js')) . '?' . $default_query_string . '"></script>' . "\n<![endif]-->";
-    $expected_2 = "<!--[if !IE]><!-->\n" . '<script src="' . file_url_transform_relative(file_create_url('core/modules/system/tests/modules/common_test/no-ie.js')) . '?' . $default_query_string . '"></script>' . "\n<!--<![endif]-->";
+    $expected_1 = "<!--[if lte IE 8]>\n" . '<script src="' . file_url_transform_relative(file_create_url('core/modules/system/tests/modules/common_test/old-ie.js')) . '?' . $default_query_string . '"></script><![endif]-->';
+    $expected_2 = "<!--[if !IE]><!-->\n" . '<script src="' . file_url_transform_relative(file_create_url('core/modules/system/tests/modules/common_test/no-ie.js')) . '?' . $default_query_string . '"></script><!--<![endif]-->';
 
     $this->assertNotIdentical(strpos($rendered_js, $expected_1), FALSE, 'Rendered JavaScript within downlevel-hidden conditional comments.');
     $this->assertNotIdentical(strpos($rendered_js, $expected_2), FALSE, 'Rendered JavaScript within downlevel-revealed conditional comments.');
diff --git a/core/modules/system/src/Tests/Common/RenderElementTypesTest.php b/core/modules/system/src/Tests/Common/RenderElementTypesTest.php
index e60bb52..cea8cad 100644
--- a/core/modules/system/src/Tests/Common/RenderElementTypesTest.php
+++ b/core/modules/system/src/Tests/Common/RenderElementTypesTest.php
@@ -89,7 +89,7 @@ function testHtmlTag() {
         'name' => 'description',
         'content' => 'Drupal test',
       ),
-    ), '<meta name="description" content="Drupal test" />' . "\n", "#type 'html_tag', void element renders properly");
+    ), '<meta name="description" content="Drupal test" />', "#type 'html_tag', void element renders properly");
 
     // Test non-void element.
     $this->assertElements(array(
@@ -99,19 +99,19 @@ function testHtmlTag() {
       '#attributes' => array(
         'class' => array('unicorns'),
       ),
-    ), '<section class="unicorns">value</section>' . "\n", "#type 'html_tag', non-void element renders properly");
+    ), '<section class="unicorns">value</section>', "#type 'html_tag', non-void element renders properly");
 
     // Test empty void element tag.
     $this->assertElements(array(
       '#type' => 'html_tag',
       '#tag' => 'link',
-    ), "<link />\n", "#type 'html_tag' empty void element renders properly");
+    ), '<link />', "#type 'html_tag' empty void element renders properly");
 
     // Test empty non-void element tag.
     $this->assertElements(array(
       '#type' => 'html_tag',
       '#tag' => 'section',
-    ), "<section></section>\n", "#type 'html_tag' empty non-void element renders properly");
+    ), '<section></section>', "#type 'html_tag' empty non-void element renders properly");
   }
 
   /**
diff --git a/core/tests/Drupal/KernelTests/KernelTestBaseTest.php b/core/tests/Drupal/KernelTests/KernelTestBaseTest.php
index 30f05b2..2936713 100644
--- a/core/tests/Drupal/KernelTests/KernelTestBaseTest.php
+++ b/core/tests/Drupal/KernelTests/KernelTestBaseTest.php
@@ -175,7 +175,7 @@ public function testRender() {
       '#tag' => 'h3',
       '#value' => 'Inner',
     );
-    $expected = "<h3>Inner</h3>\n";
+    $expected = '<h3>Inner</h3>';
 
     $this->assertEquals('core', \Drupal::theme()->getActiveTheme()->getName());
     $output = \Drupal::service('renderer')->renderRoot($build);
diff --git a/core/tests/Drupal/Tests/Core/Render/Element/HtmlTagTest.php b/core/tests/Drupal/Tests/Core/Render/Element/HtmlTagTest.php
index bef5cef..b5eb464 100644
--- a/core/tests/Drupal/Tests/Core/Render/Element/HtmlTagTest.php
+++ b/core/tests/Drupal/Tests/Core/Render/Element/HtmlTagTest.php
@@ -44,20 +44,20 @@ public function providerPreRenderHtmlTag() {
       '#value' => 'value',
       '#tag' => 'p',
     );
-    $tags[] = array($element, '<p>value</p>' . "\n");
+    $tags[] = array($element, '<p>value</p>');
 
     // Normal element without a value should not result in a void element.
     $element = array(
       '#tag' => 'p',
       '#value' => NULL,
     );
-    $tags[] = array($element, "<p></p>\n");
+    $tags[] = array($element, '<p></p>');
 
     // A void element.
     $element = array(
       '#tag' => 'br',
     );
-    $tags[] = array($element, "<br />\n");
+    $tags[] = array($element, '<br />');
 
     // Attributes.
     $element = array(
@@ -65,32 +65,32 @@ public function providerPreRenderHtmlTag() {
       '#attributes' => array('class' => 'test', 'id' => 'id'),
       '#value' => 'value',
     );
-    $tags[] = array($element, '<div class="test" id="id">value</div>' . "\n");
+    $tags[] = array($element, '<div class="test" id="id">value</div>');
 
     // No script tags.
     $element['#noscript'] = TRUE;
-    $tags[] = array($element, '<noscript><div class="test" id="id">value</div>' . "\n" . '</noscript>');
+    $tags[] = array($element, '<noscript><div class="test" id="id">value</div></noscript>');
 
     // Ensure that #tag is sanitised.
     $element = array(
       '#tag' => 'p><script>alert()</script><p',
       '#value' => 'value',
     );
-    $tags[] = array($element, "<p&gt;&lt;script&gt;alert()&lt;/script&gt;&lt;p>value</p&gt;&lt;script&gt;alert()&lt;/script&gt;&lt;p>\n");
+    $tags[] = array($element, '<p&gt;&lt;script&gt;alert()&lt;/script&gt;&lt;p>value</p&gt;&lt;script&gt;alert()&lt;/script&gt;&lt;p>');
 
     // Ensure that #value is not filtered if it is marked as safe.
     $element = array(
       '#tag' => 'p',
       '#value' => Markup::create('<script>value</script>'),
     );
-    $tags[] = array($element, "<p><script>value</script></p>\n");
+    $tags[] = array($element, '<p><script>value</script></p>');
 
     // Ensure that #value is filtered if it is not safe.
     $element = array(
       '#tag' => 'p',
       '#value' => '<script>value</script>',
     );
-    $tags[] = array($element, "<p>value</p>\n");
+    $tags[] = array($element, '<p>value</p>');
 
     return $tags;
   }
