Very obscure possible bug in StyleSheetCombiner

This is the place to report bugs and get support. When posting in this forum, please always provide as much detail as possible.

Please do not report problems with a custom build or custom code in this forum. If you are producing your own build from the source code and have problems or questions, ask in the developer forum, do not report it as a bug.

This is the place to report bugs and get support

When posting in this forum, please try to provide as many relevant details as possible. Particularly the following:

  • What operating system were you running when the bug appeared?
  • What database platform is your site using?
  • What version of mojoPortal are you running?
  • What version of .NET do you use?
  • What steps are necessary to reproduce the issue? Compare expected results vs actual results.
Please do not report problems with a custom build or custom code in this forum. If you are producing your own build from the source code and have problems or questions, ask in the developer forum.
This thread is closed to new posts. You must sign in to post in the forums.
3/10/2014 1:18:20 PM
Gravatar
Total Posts 121

Very obscure possible bug in StyleSheetCombiner

Hi Joe, I'm writing this up just in case it is a fixable bug, and for essential catharsis if it is not.

I upgraded a site from 2.3.9.0 to 2.4.0.2 today, and the menu broke in IE and FF. It was a standard horizontal portal:SiteMenu. Also, various other things were not working, like a RSS scroller. Everything worked fine in Chrome.

After much investigation, the cause turned out to be this CSS in style.css:

#ctl00_mainContent_OrderDetailView1_lblTicketPrice:after { content:' (not really! The actual amount will be on your invoice) '; }

It appears the mojoPortal CSS combiner breaks this across lines on the final bracket, which in IE/FF causes problems.

Changing this to

#ctl00_mainContent_OrderDetailView1_lblTicketPrice:after { content:' not really! The actual amount will be on your invoice '; }

makes everything work again.

Could the css combiner avoid breaking lines on the bracket?

3/11/2014 12:04:26 PM
Gravatar
Total Posts 18439

Re: Very obscure possible bug in StyleSheetCombiner

Hi,

There are some known issues with CSS handler that would be difficult to fix and are unlikely to be fixed unless someone comes along who is much more skilled with regular expressions than myself and is able to provide a fix.

What I can tell you is that the problem happens because of the way we must change css background images to have urls that are relative to the root of the site and we use regex to find them and insert the base url.

In general the css handler is able to process them correctly so long as the opening and closing parenthesis are on the same line within the raw css and if no 2 sets of parenthesis are on any single line.

So for example I "think" it should work if the raw css is formatted like this:

#ctl00_mainContent_OrderDetailView1_lblTicketPrice:after { 
content:' (not really! The actual amount will be on your invoice) ';
 }

so that both the opening parenthesis and closing parenthesis are on the same line with no other parenthesis on that line.

But if it doesn't work I don't know  how to fix it.

I do know that when using multiple comma separated background images in css there are problems which can be fixed by putting each image on its own line with its own parenthesis so hopefully the same solution would work for this problem.

Hope that helps,

Joe

3/12/2014 9:25:19 AM
Gravatar
Total Posts 121

Re: Very obscure possible bug in StyleSheetCombiner

Thanks Joe. No guarantees but I have a colleague who might relish the challenge - is the relevant code easy to find, with some documentation as to what it is needing to achieve? Is it all about the background images?

It would also be nice to avoid having to edit the themeroller css to get around presumably the same issue.

3/12/2014 12:45:25 PM
Gravatar
Total Posts 18439

Re: Very obscure possible bug in StyleSheetCombiner

Hi Crispin,

The relevant code is in CSSHandler.cs (stylesheet combiner doesn't really do the combining it just links to the csshandler), yes as far as a I recall its all about resolving background image urls to make them either fully qualified or relative to the site root. The regex expression is defined near the top so if you have a guru who can make the expression work better that would be cool with me. We could potentially move the regex expression into a web.config setting to make it easier to modify.

In general myself I am moving away from use of csshandler with my sites choosing instead to copy the combined and minified css output from the handler into a static css file and linking that directly instead of csshandler to reduce the overhead of processing the css. I'll be doing that soon on this site and writing some documentation about how to do it. CSSHandler is convenient but once the design is completed and won't be changing I think it makes sense to remove css handler from the equation for best performance because even though the css is cached it is a fairly heavy request to process when it isn't cached or when the cache is expired.

Best,

Joe

You must sign in to post in the forums. This thread is closed to new posts.