views:

174

answers:

2

If i have a page with 50 div elements, with 50 seperate css classes, and each css class has the line:

background:#000 url(curve_red/circle.png) no-repeat 0 0;

Then Firefox (3.5) will make 50 http requests for the same file (verified using firebug).

However IE will see this repetition and not attempt to redownload the file after each request (verified using fiddler).

Is this a bug or can anyone offer any insight as to why firefox does this?

+1  A: 

Just a guess, but could you try putting the background property into just 1 css class instead of 50? This would at least get rid of repetition in your css, and may explain why FF isn't making just 1 request.

Of course you can add multiple classes to your divs so that they can still keep the other seperate styles e.g.

.myBackground { background:#000 url(curve_red/circle.png) no-repeat 0 0; }
.class1 { color: blue; }
.class2 { color: red; }

and then in your html:

<div class="class1 myBackground">blue div</div>
<div class="class2 myBackground">red div</div>
Sam Wessel
A: 

Did you disable caching for some reason? This could have happened either via an extension (you never known) or through reloading the page using a key combination like CTRL-F5 or CTRL-SHIFT-R instead of just F5 or CTRL-R. Besides that, I haven't been able to reconstruct this behaviour. I think you're save to say that it's quite certainly not a bug in Firefox 3.5.

You could also check the issue with a fresh profile (restart Firefox with the -P command line switch to access the profile manager).

Marc Ermshaus