Closed (fixed)
Project:
Drupal core
Version:
6.x-dev
Component:
base system
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
2 Jun 2008 at 18:03 UTC
Updated:
22 Jun 2010 at 14:50 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
kkaefer commentedAnother, related bug in Drupal 6 is fixed in this patch: The path to relatively referenced urls in
@imported was sometimes not correct: when that file was in the same directory as the file that@imports it,dirname()returns.as directory name. However, the filename normalizer (which removesdirectory/..segments to shorten the path), also removed that./, which resulted in the file being referenced in the wrong directory.The attached patch fixes both issues. This bug is most likely also present in Drupal 7.
Comment #2
Andrey Zakharov commentedhave same issue, just have in original css:
in aggregated:
Comment #3
kkaefer commentedBoth patches are ready for review. I can't review them because I wrote them. I think they are ready for being committed, though.
Comment #4
kkaefer commentedComment #5
mcarbone commentedYes, this seems to work great, although technically you should be allowing white space after the 'url(' and before the pathname as well. See: http://www.w3.org/TR/REC-CSS1/#url
Comment #6
mcarbone commentedAnd actually, it doesn't seem like W3C allows whitespace between the 'url' and '('.
Comment #7
mcarbone commentedThis problem exists in D7 as well, so it should probably be addressed there first (and will likely get more attention that way). The patch doesn't apply cleanly there, but it needs some work in any case, I think.
Comment #8
mcarbone commentedComment #9
hargobindTesting report using patch in #1 on Drupal 6.12...
Here are a couple of errors I was experiencing with CSS Optimization:
- Paths were being stripped or truncated (e.g.
url(../images/img.gif)would becomeurl(css/))- Quote characters would be semi-stripped (e.g.
url("images/img.gif")would becomeurl("images/img.gif))The patch in #1 appears to have fixed this, and the site is now loading correctly.
Thank you!
Comment #10
casey commentedtagging
Comment #11
JacobSingh commentedThis is a *really* bad bug that wasted *a lot* of my time today.
We found this using jQuery UI, it's a wonder it hasn't been found by many people.
To illustrate what the description says, if you have a css file like this:
ui.all.css:
and
ui.theme.css
it will become (in the aggregated file):
This could be harmless in FF, but actually causes IE to not render the CSS at all! I took many hours of debugging to figure this out - and then the issue was easier to find., so let's prevent that in the future.
Attached is a patch for Drupal 7, I didn't test the D6 patch, but this patch is just a copy of it, and looks RTBC.
Comment #12
webchickObviously we're missing some test coverage here.
Comment #13
casey commentedThis could easily be written without the double dirname.
Comment should also state that it's not altering absolute paths.
Comment #14
ksenzeeI resurrected some @import tests rfay wrote in #472820: drupal_load_stylesheet_content() removes whitespace improperly, creating invalid CSS and added the line Jacob pointed out is breaking. They pass with the patch, and fail without it. Yay tests. Please credit rfay on commit. I also incorporated casey's feedback and improved some comments.
Comment #15
Anonymous (not verified) commentedI can't test it on internet explorer at the moment. I can however verify (with the help of the W3C CSS Validator) that the CSS that is being produced no longer malformed. The only reason that I cannot RTBC is that I don't have IE running at the moment.
Comment #16
Anonymous (not verified) commentedI've just tested this patch on multiple installation. It's fixed the problem on all of them that were exhibiting the CSS import problem. :)
Comment #17
webchickExcellent! Thanks for the quick turnaround on those tests, ksenzee (and rfay!)
Committed to HEAD.
Comment #18
webchickOops. And this needs porting to 6.x.
Comment #19
ksenzeeHere's a D6 port. I included a line that was in kkaefer's original D6 patch but that Jacob left out of the D7 version. It's an edit to the regex at line 1928 of common.inc (inside drupal_build_css_cache()) that allows whitespace in a path like "url (someimage.jpg)". Without this edit, paths have to look like "url(someimage.jpg)". Jacob, was that intentional because we fixed it elsewhere in D7?
Comment #20
ksenzeeThe "Save" and "Attach" buttons are very close together. :)
Comment #21
hargobindThat last patch is very close but needs a minor cleanup. I would do it myself but I don't know how to create a patch file yet.
The change is on line 30 of that file:
...needs to become:
And you could even concatenate the comment on line 23 & 24 into a single line comment.
I've tested this code and it works great on my 6.14 site where I regularly get 50K hits a day.
Comment #22
pivica commentedI have rerolled a patch from #14 against latest Drupal 6 dev version. Tested on a site where I have a same problem like on #11 and now css aggregation works.
And here is an answer to #19
This is mentioned in #6 - it is not allowed to have space between url and (, so a path like "url (someimage.jpg)" is not a valid syntax.
Comment #23
hargobind@pivica good call on the spacing issue with "url (".
Tested here too. Now what will it take to roll this into 6.x HEAD?
Comment #24
ayalon commentedHi
I suffered also the jQuery UI CSS Optimization Bug. This is really critical, because Optimization will break the CSS file as soon as you have the jQuery UI Module enabled!
I tested the patch #22 and it fixes the issue. Please commit this patch to the next Drupal release.
Comment #25
ayalon commentedAdding new tags
Comment #26
casey commentedBetter use more generic tags.
Comment #27
ayalon commentedPlease commit this to the next drupal release. Everyone using jQuery UI and CSS Optimization will suffer from wrong css code!
Comment #28
gooddesignusa commentedOMG thank you so much. I was going crazy haha. patch from #22 worked :) thanks alot
Comment #29
gábor hojtsyThanks for testing, committed.
Comment #30
ayalon commentedYeah! Thanks Gabor!
Comment #32
asb commentedThe patch applies cleanly against Pressflow 6.16 (!):
...and also it seems to fix this issue: #833070: Acquia Slate 3.x incompatible with core CSS optimization (whichs appears with Opera 10.53/Win).
Thanks & greetings,
-asb