Rails 3.1, asset pipeline and IE 6 and 7 in production mode - some CSS and js do not load properly

Try the Rails 3.1 application in production mode (Debian 6, Ruby 1.9.2, Passenger). I tried using IE 6 and IE 7, and some of them are not loaded properly. Everything works fine in dev mode.

Some css and js do not load properly, all files are compiled. In particular, I have problems with a drop down menu (jQuery superfish). Everything works fine in IE8, IE 9, Firefox, Chrome both in production and in development. The problem only occurs in IE 6 and 7 in Production.

I tried to clear the cache (both in the browser and on the server). Recompilation of assets. Nothing will help.

Has anyone come across something like this?

+6
source share
3 answers

For those who have the same problem, here is the root of the problem from MS Support ( http://support.microsoft.com/kb/262161 ):

This problem occurs because in Internet Explorer: all style tags after the first 31 style tags are not applied. All style rules after the first 4095 rules do not apply. On pages that use the @import rule to continuously import, external style sheets that import other style sheets, style sheets that contain more than three levels, are ignored.

ARRRRRRRRRRRRRRRR !!! Killed a couple of days trying to track down a problem with my code when it again was not complying with MS standards! # @) (@ #)

This led me to further research, and to my surprise, IE6 and IE7 seem to only process the first 2025 lines in a large css file - the rest is ignored. (at first I thought it was a limit on the number of lines, but it turned out that it was 4095 rules, which were on 2025 lines). It just seems stupid. The new IE and Chrome, Safari, Opera and FF do not seem to have problems with this. I ended up breaking my css into application-1.css and application-2.css to keep the number of files in produciton to a minimum, but this is still very annoying.

+9
source

Is debugging enabled? those. Are your javascript separated in design mode?

Try disabling it so that the resource pipeline combines everything in one file and see if it still works in development mode.

I had several problems when the assets were combined together and one of the files was missing a semicolon. It may be a hassle to find, but it can happen. Other best browsers make them ok, but IE just mixes things up.

+1
source

There is a great CssSplitter module that people use to split css files, i.e. It has been adapted for use in the asset pipeline. https://gist.github.com/2398394

+1
source

Source: https://habr.com/ru/post/904418/


All Articles