Bug #60675

CSS compressor is removing white spaces (font directive)

Added by Nico Niebergall over 6 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Must have
Category:
Content Rendering
Target version:
Start date:
2014-07-30
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
6.2
PHP Version:
5.5
Tags:
Complexity:
hard
Is Regression:
No
Sprint Focus:

Description

Today I noticed the internal CSS compressor is removing white spaces between the font size and the font family. Of course the white space should stay there. Some browsers will still render the font family correct, some other's dont, but the CSS syntax is clearly wrong without the white space.

The white space is removed when you use a font-family surrounded with quotation marks, and only in this particular case. If you remove the quotation marks the white space won't get removed. According to the W3C the apostrophes are needed for strings with white spaces, as stated here: 4.3.7 Strings

This is a snippet of the code where I was facing this symptom:

Before minifying

body {
    font: 0.875em "Open Sans", Arial, Helvetica, sans-serif;
    line-height: 2em;
}

After minifying

body{font:0.875em"Open Sans",Arial,Helvetica,sans-serif;line-height:2em}

It doesn't matter if you use a single quotation or a double quotation mark, the white space is removed as soon as you surround the font-face with (single or double) quotation marks. Is this a bug?

Kind regards,
Nico


Related issues

Related to TYPO3 Core - Bug #63974: CSS concatination and compression failes with fontClosed2014-12-18

Actions
#1

Updated by Markus Klein over 6 years ago

  • Category changed from Miscellaneous to Content Rendering
  • Status changed from New to Accepted
  • Priority changed from Should have to Must have
  • Target version set to next-patchlevel
  • Complexity changed from medium to hard

Yes it is! Thanks for reporting.

The problem seems to be in ResourceCompressor::compressCssFile().
Unfortunately there are no unit tests.

#2

Updated by Gerrit Code Review over 6 years ago

  • Status changed from Accepted to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/31954

#3

Updated by Jigal van Hemert over 6 years ago

  • Status changed from Under Review to Accepted
  • Assignee set to Jigal van Hemert
#4

Updated by Jigal van Hemert over 6 years ago

  • Status changed from Accepted to Under Review
#5

Updated by Gerrit Code Review over 6 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/31954

#6

Updated by Gerrit Code Review over 6 years ago

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/32303

#7

Updated by Gerrit Code Review over 6 years ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/31954

#8

Updated by Gerrit Code Review over 6 years ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/31954

#9

Updated by Mathias Schreiber almost 6 years ago

  • Target version changed from next-patchlevel to 7.2 (Frontend)
#10

Updated by Riccardo De Contardi over 5 years ago

  • Status changed from Under Review to Closed

Please continue the disussion on #63974

Also available in: Atom PDF