See #1675894: Make calendar flexible and responsive where we tried to make the layout flexible and responsive.
Example code:
.calendar-calendar .month-view .full tr td.single-day:before {
content: attr(data-day-of-month) ", " attr(headers);
font-weight: bold;
}
Results in compressed CSS code with the space removed in ","
.
We should not optimize content at all or correct it with unicode representations like \0000a0
to prevent this.
Related:
#1741498: Add a responsive preview bar to Drupal core
#936316: CSS aggregation strips some essential whitespace within strings
Comment | File | Size | Author |
---|---|---|---|
#3 | drupal-css_content_attribute-1686178-3.patch | 1.33 KB | bkonetzny |
Comments
Comment #1
hass CreditAttribution: hass commentedComment #2
bkonetzny CreditAttribution: bkonetzny commentedIdentified the problem in drupal_load_stylesheet_content() in the following line:
This code removes whitespace before and after "@{};,", so fine for regular css, but not for content with @{};, and spaces around it. Content without @{};, will work fine right now.
Comment #3
bkonetzny CreditAttribution: bkonetzny commentedAttached patch for drupal 7 where content declarations are extracted and saved before whitespace cleanup and inserted afterwards.
Comment #5
hass CreditAttribution: hass commentedI think it would be a lot easier if we only replace the spaces with the unicode value \0000a0.
Comment #6
hass CreditAttribution: hass commented#3: drupal-css_content_attribute-1686178-3.patch queued for re-testing.
Comment #8
hass CreditAttribution: hass commentedComment #8.0
hass CreditAttribution: hass commenteda
Comment #8.1
hass CreditAttribution: hass commentedA
Comment #9
mikeytown2 CreditAttribution: mikeytown2 commentedPlayed around with this a little bit in #2067249: Add in the ability for the CSS content attribute to be translated. and I would change the preg_replace_callback so that it doesn't use an anonymous function. Also the content regex doesn't match the example given in the Issue Summary. Following regex will match
/content:.*?($double_quot|$single_quot).*?(?:\\;|\\})/
.Comment #9.0
mikeytown2 CreditAttribution: mikeytown2 commentedA
Comment #10
John_B CreditAttribution: John_B commentedThere seems to be a problem with the string
),
in selectors. In D7 the aggregator breaksul:not(.contextual-links), body etc
, selectors following the comma are lost.Comment #11
AnybodyWhat can we do here to take this forward?
This problem occurs again and again and leads to subsequent problems like #2511524: Add a setting to turn on / off css "optimizing".
Comment #12
Wim LeersWrite a test that causes failures. Then add the fix and show the new test no longer fails.
Comment #16
Anonymous (not verified) CreditAttribution: Anonymous commented#936316: CSS aggregation strips some essential whitespace within strings solved this problem.
Before aggregation:
After aggregation:
.calendar-calendar .month-view .full tr td.single-day:before{content:attr(data-day-of-month) ", " attr(headers);font-weight:bold;}
Comment #17
Anonymous (not verified) CreditAttribution: Anonymous commentedClosed like duplicate #936316: CSS aggregation strips some essential whitespace within strings