A '\n' (newline) character is included at the end of every tag output by theme_html_tag(). This causes extra whitespace that may not always be desired. One specific example is for use with sprite icons that are included within links.

<a href="#"><span class="sprite"></span>Text</a> 

If the span above is rendered using theme_html_tag() then there will be extra whitespace between the icon and the text because of the newline character. Any spacing would be better controlled by css (margin or padding).

Related CR https://www.drupal.org/node/2019739

CommentFileSizeAuthor
#98 1268180-98.patch9.94 KBandypost
#98 interdiff.txt6.79 KBandypost
#97 1268180-97.patch5.39 KBandypost
#97 interdiff.txt602 bytesandypost
#96 1268180-96.patch5.73 KBandypost
#96 interdiff.txt5.75 KBandypost
#89 1268180-89.patch17.23 KBckidow
#88 1268180-86.patch17.16 KBdaniel kulbe
#86 1268180-86.patch0 bytesdaniel kulbe
#85 1268180-85.patch17.34 KBdaniel kulbe
#83 interdiff_81-83.txt11.38 KBnikitagupta
#83 1268180-83.patch17.05 KBnikitagupta
#81 newline_character_in-1268180-81.patch6.11 KBdaniel kulbe
#77 newline_character_in-1268180-77.patch6.04 KBandypost
#71 newline_character_in-1268180-71.patch6.04 KBandypost
#71 interdiff.txt15.85 KBandypost
#69 newline_character_in-1268180-69.patch14.34 KBandersen_ti
#69 interdiff.txt1.17 KBandersen_ti
#67 newline_character_in-1268180-67.patch14.7 KBandypost
#67 interdiff.txt1.6 KBandypost
#62 newline_character_in-1268180-62.patch13.61 KBandypost
#60 newline_character_in-1268180-60.patch13.57 KBandypost
#59 newline_character_in-1268180-45-reroll.patch12.23 KBjoelpittet
#45 interdiff.txt1018 bytesjoelpittet
#45 newline_character_in-1268180-45.patch12.33 KBjoelpittet
#42 interdiff.txt983 bytesjoelpittet
#42 newline_character_in-1268180-42.patch12.32 KBjoelpittet
#39 newline_character_in-1268180-39.patch12.31 KBjoelpittet
#39 interdiff.txt2.54 KBjoelpittet
#37 interdiff.txt2.16 KBjoelpittet
#37 newline_character_in-1268180-37.patch13.31 KBjoelpittet
#31 newline_character_in-1268180-31.patch11.15 KBdimaro
#29 1268180-29.patch11.08 KBandypost
#29 interdiff.txt1.8 KBandypost
#25 1268180-25.patch11.08 KBandypost
#25 interdiff.txt2.07 KBandypost
#23 1268180-23.patch9.01 KBandypost
#23 interdiff.txt5.6 KBandypost
#21 newline_character_in-1268180-21.patch3.41 KBjoelpittet
#16 1268180-16.patch662 byteslokapujya
#8 newline-causes-unwanted-whitespace-1268180-6.patch3.43 KBdraenen
#5 newline-causes-unwanted-whitespace-1268180-5.patch860 bytesdraenen
#1 remove-newlines-1268180-1.patch874 bytesdraenen

Comments

draenen’s picture

StatusFileSize
new874 bytes

Patch removes newlines.

draenen’s picture

Status: Active » Needs review
tr’s picture

Version: 7.x-dev » 8.x-dev
Issue tags: +Needs backport to D7

This needs to go into D8 first.

c960657’s picture

Status: Needs review » Needs work

Patch no longer applies to D7 – requires a reroll.

Also, please provide a patch for D8 also.

draenen’s picture

Status: Needs work » Needs review
StatusFileSize
new860 bytes

Status: Needs review » Needs work

The last submitted patch, newline-causes-unwanted-whitespace-1268180-5.patch, failed testing.

tr’s picture

You have to change the test too, because the test is expecting the theme function to output the "\n".

draenen’s picture

Status: Needs work » Needs review
StatusFileSize
new3.43 KB

Trying again. The newline character is acceptable (even preferred) in most cases, so we'll just add a #newline option that can be set to false.

tr’s picture

Status: Needs review » Needs work

The last submitted patch, 8: newline-causes-unwanted-whitespace-1268180-6.patch, failed testing.

star-szr’s picture

Probably the most relevant issue to look at is #1825090: Remove theme_html_tag() from the theme system, not sure if this is still relevant for 8.x or not.

The last submitted patch, 1: remove-newlines-1268180-1.patch, failed testing.

andypost’s picture

Issue tags: +Needs reroll
andypost’s picture

Issue summary: View changes
lokapujya’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
StatusFileSize
new662 bytes
andypost’s picture

#8 makes BC

+++ b/core/modules/system/system.module
@@ -316,6 +316,7 @@ function system_element_info() {
+    '#newline' => TRUE,

why this was removed in reroll?

Status: Needs review » Needs work

The last submitted patch, 16: 1268180-16.patch, failed testing.

lokapujya’s picture

Step by Step. The theme function was converted to a render array so the code is very different. It's not a typical reroll, but a start from scratch. So, now #16 shows which tests break without making the newline optional.

*If someone wants to add that parameter in, I probably won't have any time to work on it for a few days.

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

joelpittet’s picture

Status: Needs work » Needs review
StatusFileSize
new3.41 KB

Do we really need this to be BC? I'd suggest we don't add the BC layer for this and just fix it. Whitespace around block elements shouldn't be expected, IMO. It breaks more things than it solves.

Status: Needs review » Needs work

The last submitted patch, 21: newline_character_in-1268180-21.patch, failed testing.

andypost’s picture

Status: Needs work » Needs review
StatusFileSize
new5.6 KB
new9.01 KB

fix remaining tests

Status: Needs review » Needs work

The last submitted patch, 23: 1268180-23.patch, failed testing.

andypost’s picture

Status: Needs work » Needs review
StatusFileSize
new2.07 KB
new11.08 KB

fix leftovers

joelpittet’s picture

Status: Needs review » Reviewed & tested by the community

Thank you for fixing the remaining tests @andypost

xjm’s picture

Assigned: Unassigned » star-szr

Themey things.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
+++ b/core/lib/Drupal/Core/Render/Element/HtmlTag.php
@@ -87,13 +87,13 @@ public static function preRenderHtmlTag($element) {
-      $markup .= " />\n";
+      $markup .= " />";
...
-      $markup .= '</' . $escaped_tag . ">\n";
+      $markup .= '</' . $escaped_tag . ">";

Let's change these to single quotes. Considering we've changed this elsewhere.

andypost’s picture

Status: Needs work » Needs review
StatusFileSize
new1.8 KB
new11.08 KB

Fixed #29 + trailing comma

star-szr’s picture

Title: Newline character in theme_html_tag causes unwanted whitespace. » Newline character in HtmlTag causes unwanted whitespace
Version: 8.1.x-dev » 8.2.x-dev
Assigned: star-szr » Unassigned
Status: Needs review » Needs work
Issue tags: +Needs change record, +Needs reroll, +Novice

Looks like this needs a reroll after #2687897: Convert system module's kernel tests to NG otherwise looking good I'd say. I do wonder if we should consider adding a change record here because contrib may be relying on the whitespace in automated tests as well. I'd also like to bump this to 8.2.x for that reason and I agree no BC layer is needed.

Checking patch core/lib/Drupal/Core/Render/Element/HtmlTag.php...
Checking patch core/modules/big_pipe/src/Tests/BigPipePlaceholderTestCases.php...
Checking patch core/modules/big_pipe/src/Tests/BigPipeTest.php...
Checking patch core/modules/system/src/Tests/Common/AttachedAssetsTest.php...
error: core/modules/system/src/Tests/Common/AttachedAssetsTest.php: No such file or directory
Checking patch core/modules/system/src/Tests/Common/RenderElementTypesTest.php...
error: core/modules/system/src/Tests/Common/RenderElementTypesTest.php: No such file or directory
Checking patch core/tests/Drupal/KernelTests/KernelTestBaseTest.php...
Checking patch core/tests/Drupal/Tests/Core/Render/Element/HtmlTagTest.php...
dimaro’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
StatusFileSize
new11.15 KB

Rerolled #29.
Patch against 8.2.x

andypost’s picture

Issue tags: -Needs change record
andypost’s picture

Status: Needs review » Reviewed & tested by the community

I think that ready, CR review could be done later

alexpott’s picture

This is where a visual regression test would be super useful.

xjm’s picture

Assigned: Unassigned » star-szr

Discussed #34 with @alexpott; this is more a proposal for followup work. For this issue, thorough manual testing and the CR are sufficient. We are also making the change in 8.2.x only per @Cottser's feedback in #30, because of the risk of disruption.

Assigning to @Cottser for review. Thanks everyone!

star-szr’s picture

Assigned: star-szr » Unassigned
Status: Reviewed & tested by the community » Needs work
Issue tags: -Novice

After poking around with this one I think we need to consider this further. This makes the page source rather hard to read in spots. Maybe everyone uses a web inspector but I'm not sure about this for DX/TX and so on. One potential idea would be to always include the whitespace for elements that we know are non-rendering like meta, link, script, etc. but not sure how viable that is.

View source before the patch:

<meta charset="utf-8" />
<meta name="Generator" content="Drupal 8 (https://www.drupal.org)" />
<meta name="MobileOptimized" content="width" />
<meta name="HandheldFriendly" content="true" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="shortcut icon" href="/core/misc/favicon.ico" type="image/vnd.microsoft.icon" />
<link rel="alternate" type="application/rss+xml" title="" href="http://d8.dev/en/rss.xml" />

After:

<meta charset="utf-8" /><meta name="Generator" content="Drupal 8 (https://www.drupal.org)" /><meta name="MobileOptimized" content="width" /><meta name="HandheldFriendly" content="true" /><meta name="viewport" content="width=device-width, initial-scale=1.0" /><link rel="shortcut icon" href="/core/misc/favicon.ico" type="image/vnd.microsoft.icon" /><link rel="alternate" type="application/rss+xml" title="" href="http://d8.dev/en/rss.xml" />

If you look at the scripts at the bottom of the page it's an even bigger pile of messiness.

joelpittet’s picture

Status: Needs work » Needs review
StatusFileSize
new13.31 KB
new2.16 KB

That is a good point @Cottser. Let's add the \n character back to the elements that go into the head. There are only a few places that would be needed.

See attached patch and interdiff

Status: Needs review » Needs work

The last submitted patch, 37: newline_character_in-1268180-37.patch, failed testing.

joelpittet’s picture

Status: Needs work » Needs review
StatusFileSize
new2.54 KB
new12.31 KB

May still have a fail in there, but this is the tweak because one of the test is rendering them through the asset collection renderers so it has the \n

andypost’s picture

Assigned: Unassigned » star-szr
Status: Needs review » Reviewed & tested by the community

#36 is really debatable, 99% of time better to have page size smaller but for me having new line for header is fine

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 39: newline_character_in-1268180-39.patch, failed testing.

joelpittet’s picture

Assigned: star-szr » Unassigned
Status: Needs work » Needs review
StatusFileSize
new12.32 KB
new983 bytes

This is going to fail too on bigpipe. There is an extra line in the output. Fixes the other test, the order of the keys was the fail there.

Status: Needs review » Needs work

The last submitted patch, 42: newline_character_in-1268180-42.patch, failed testing.

andypost’s picture

@Joel I can't find why https://www.evernote.com/shard/s710/sh/fc945925-4056-4035-846f-8ca414577... that happens, I will try to find time this WE

joelpittet’s picture

Status: Needs work » Needs review
StatusFileSize
new12.33 KB
new1018 bytes

No worries, I think I found it. Went a bit far on removing the \n from a test case for a <link that wasn't being built by the other stuff.

andypost’s picture

Status: Needs review » Reviewed & tested by the community

Yay, thanx a lot!!! Let's get this finally in

joelpittet’s picture

Assigned: Unassigned » star-szr

Back to @Cottser for the word

star-szr’s picture

Assigned: star-szr » Unassigned
Status: Reviewed & tested by the community » Needs review

Hmm I was thinking the change would be in the HtmlTag element, not a bunch of places where we use that element. This method seems like it'll be inconsistent if anyone outside of core uses '#type' => 'html_tag' with link, meta, etc.

joelpittet’s picture

@Cottser, I'd rather not muddy the tag with exceptions/conditional code. IMO it shouldn't be expected that we are putting whitespace on tags or specific tags, and if someone wants to that they can do as I did in the patch with '#suffix' => "\n"

The exceptions are explicit to the parts of the code where they are 'needed'. They are only really useful in dev, in production I'd even remove those '\n', but don't want to scope creep this.

andypost’s picture

Assigned: Unassigned » star-szr

@Cottser there's 2 separate tasks discussed:
1) *bug* the issue - unwanted whitespace
2) dev time setting to have head "fine-printed - looks like follow-up

Suppose better commit #31 and discover "developer setting" in follow-up issue

andypost’s picture

Suppose page size optimization is small but it is

star-szr’s picture

Assigned: star-szr » alexpott

Assigning to @alexpott for a second opinion since he reviewed this as well.

alexpott’s picture

Version: 8.2.x-dev » 8.3.x-dev
Assigned: alexpott » Unassigned

I think we should get this into 8.3.x early so we have a chance to catch any regressions this might cause during the cycle. The issue makes sense and seems a good idea.

joelpittet’s picture

Status: Needs review » Reviewed & tested by the community

Let's get this in early then. @Cottser, does the rational hold water or need more discussion?

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: -frontend performance, -Performance

The potential effects of this behaviour change concern me. I agree with the change but I don't think we should be making it Drupal 8. The potential to break contrib and real sites in unexpected and untested ways is high. I think we need to add a #nonewline option HtmlTag's properties and use it where appropriate. And then if anyone wants to suppress it they can. And we can change the behaviour in Drupal 9.

I'm not sure this issue should have the performance tags.

andypost’s picture

Issue tags: +frontend performance

@Alexpott this about of extra browser timing - lots of useless text elements created and bit more bytes transfered, also this very related to #736066: ajax.js insert command sometimes wraps content in a div, potentially producing invalid HTML and other bugs

#nonewline makes sense but default better to set to optimized

I think 6 month adoption cycle should be enough to revert in case of problems

alexpott’s picture

@andypost I understand this might cause bugs but so might changing the default behaviour. Wrt to frontend performance - I like to see evidence of how impactful this is going to be.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

joelpittet’s picture

Status: Needs work » Needs review
StatusFileSize
new12.23 KB

Reroll

andypost’s picture

StatusFileSize
new13.57 KB

reroll, removed unneeded changes in core/modules/big_pipe/src/Tests/BigPipePlaceholderTestCases.php

+ added fixes for core/tests/Drupal/Tests/Core/Render/Element/HtmlTagTest.php after #2694535: Support rect property and nested render arrays in html_tag for dynamic SVGs

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

andypost’s picture

StatusFileSize
new13.61 KB

Another reroll

Status: Needs review » Needs work

The last submitted patch, 62: newline_character_in-1268180-62.patch, failed testing. View results

andypost’s picture

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

andypost’s picture

Status: Needs work » Needs review
StatusFileSize
new1.6 KB
new14.7 KB

Re-roll & fix broken tests

Status: Needs review » Needs work

The last submitted patch, 67: newline_character_in-1268180-67.patch, failed testing. View results

andersen_ti’s picture

Status: Needs work » Needs review
StatusFileSize
new1.17 KB
new14.34 KB

Re-rolled.
Was conflict in CssCollectionRenderer.php and CssCollectionRendererUnitTest.php cos IE 9 support removed from core and render function was cahnged.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

andypost’s picture

StatusFileSize
new15.85 KB
new6.04 KB

I think we need to add a #nonewline option HtmlTag's properties and use it where appropriate. And then if anyone wants to suppress it they can. And we can change the behaviour in Drupal 9.

So instead of suffix it could be option of element, so contrib/custom can override default

Patch adds this option with test & reverts mostly all changes

Status: Needs review » Needs work

The last submitted patch, 71: newline_character_in-1268180-71.patch, failed testing. View results

andypost’s picture

Status: Needs work » Needs review

bot flux

lokapujya’s picture

So the new solution is not to remove the space, but to allow a way to remove it? Is anyone really going to use this feature and even know that it exists? Probably, they may just fix it with CSS.

lokapujya’s picture

As we can see, fixing the default behaviour breaks some tests (which cause us to have to fix those tests). We now were able to remove the changes to those tests because we aren't changing the default behavior. That will get revisited when the TODO is looked at for D9.

andypost’s picture

That's main problem to move this forward - how to allow change for D9

+++ b/core/lib/Drupal/Core/Render/Element/HtmlTag.php
@@ -98,6 +102,10 @@ public static function preRenderHtmlTag($element) {
+    if (empty($element['#nonewline'])) {
+      // @todo Consider to change default behaviour in Drupal 9.
+      $close_tag .= "\n";

Probably this todo should be removed...

andypost’s picture

StatusFileSize
new6.04 KB

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

daniel kulbe’s picture

StatusFileSize
new6.11 KB

Does not apply against 8.9.x anymore. Here's a re-roll.

Status: Needs review » Needs work

The last submitted patch, 81: newline_character_in-1268180-81.patch, failed testing. View results

nikitagupta’s picture

Status: Needs work » Needs review
StatusFileSize
new17.05 KB
new11.38 KB

fixed the test cases.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

daniel kulbe’s picture

StatusFileSize
new17.34 KB
daniel kulbe’s picture

StatusFileSize
new0 bytes

For "drupal/core": "~9.2.5"

daniel kulbe’s picture

broken patch ... sorry for the noise

daniel kulbe’s picture

StatusFileSize
new17.16 KB
ckidow’s picture

StatusFileSize
new17.23 KB
longwave’s picture

Status: Needs review » Needs work

The test changes in #83 onwards are all wrong, void elements should not have a closing tag.

I am not sure if we need to introduce a new property, can we go back to using #suffix and warn users with something like this?

-    $suffix = isset($element['#suffix']) ? $close_tag . $element['#suffix'] : $close_tag;
+    if (isset($element['#suffix'])) {
+      $suffix = $close_tag . $element['#suffix'];
+    }
+    else {
+      $suffix = $close_tag . "\n";
+      @trigger_error('HTML tags will no longer be suffixed with newlines from Drupal 10. Set #suffix to "\\n" to keep the existing behaviour.');
+    }

Then we can explicit set '#suffix' => '' where we want to strip the newline already.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

andypost’s picture

Issue tags: +Needs reroll
andypost’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll +Needs tests, +Needs change record updates
StatusFileSize
new5.75 KB
new5.73 KB

Addressed #90

- reverted changes to #81 (interdiff against it)
- added deprecation (needs to update CR)

After full test suite gonna add test for deprecation (looking for better wording)

andypost’s picture

StatusFileSize
new602 bytes
new5.39 KB

bit more clean-up

andypost’s picture

Issue tags: -Needs tests, -Needs change record updates
StatusFileSize
new6.79 KB
new9.94 KB

Added test and fixed existing to prevent throwing deprecation

Status: Needs review » Needs work

The last submitted patch, 98: 1268180-98.patch, failed testing. View results

heddn’s picture

The test failures show it. How do we trigger warnings without causing a lot of noise for tests?

andypost’s picture

+++ b/core/lib/Drupal/Core/Render/Element/HtmlTag.php
@@ -105,7 +105,13 @@ public static function preRenderHtmlTag($element) {
-    $suffix = isset($element['#suffix']) ? $close_tag . $element['#suffix'] : $close_tag;
+    if (isset($element['#suffix'])) {
+      $suffix = $close_tag . $element['#suffix'];
+    }
+    else {
+      $suffix = $close_tag . "\n";
+      @trigger_error('Addition of newline to HTML tags is deprecated in drupal:10.2.0 and is removed from drupal:11.0.0. Set #suffix to "\\n" to keep the existing behaviour. See https://www.drupal.org/node/2742955', E_USER_DEPRECATED);
+    }

This condition needs improvement at least a global kill-switch in settings.php to enable BC mode

longwave’s picture

Wonder if we just make this change in a minor, and a change record/release note is enough. Deprecating on unset #suffix is very noisy and I think 99% of users won't care that we make this change.

wim leers’s picture

andypost’s picture

Issue tags: +PHP 8.4

...in a light of https://wiki.php.net/rfc/opt_in_dom_spec_compliance

probably better to split out deprecation of #suffix into separate issue at least to unlock it

andypost’s picture

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.