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).

Files: 
CommentFileSizeAuthor
#8 newline-causes-unwanted-whitespace-1268180-6.patch3.43 KBdraenen
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch newline-causes-unwanted-whitespace-1268180-6.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]
#5 newline-causes-unwanted-whitespace-1268180-5.patch860 bytesdraenen
FAILED: [[SimpleTest]]: [MySQL] 35,801 pass(es), 6 fail(s), and 0 exception(s).
[ View ]
#1 remove-newlines-1268180-1.patch874 bytesdraenen
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] Unable to apply patch remove-newlines-1268180-1.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

Comments

draenen’s picture

StatusFileSize
new874 bytes
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] Unable to apply patch remove-newlines-1268180-1.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

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
FAILED: [[SimpleTest]]: [MySQL] 35,801 pass(es), 6 fail(s), and 0 exception(s).
[ View ]

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
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch newline-causes-unwanted-whitespace-1268180-6.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

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.

Cottser’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.