This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 367 - Multiple @import at-rules importing same style sheet: "Uncaught errorjava.lang.Exception: Import loop detected"
Summary: Multiple @import at-rules importing same style sheet: "Uncaught errorjava.lan...
Status: RESOLVED FIXED
Alias: None
Product: CSSValidator
Classification: Unclassified
Component: CSS 1.0 (show other bugs)
Version: CSS Validator
Hardware: Other other
: P2 normal
Target Milestone: ---
Assignee: Philippe Le Hegaret
QA Contact: qa-dev tracking
URL: http://jigsaw.w3.org/css-validator/va...
Whiteboard:
Keywords:
: 754 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-10-22 09:49 UTC by Laura Carlson
Modified: 2005-08-23 13:04 UTC (History)
2 users (show)

See Also:


Attachments

Description Laura Carlson 2003-10-22 09:49:47 UTC
I believe that the CSS Validatorhas a bug when it detects multiple 
@import directives. The CSS validator is giving me the following error 
message.


Line: 18

Uncaught errorjava.lang.Exception: Import loop detected in
http://www.d.umn.edu/~lcarlson/cssbug/


The full report is at:

http://tinyurl.com/rldp


In Eric Meyer's "Cascading Style sheets the Definitive Guide" page 15 he 
states, "...there can be more than one @import statement in a document." 
And the CSS below was valid previously. Has the validator changed?


On the Web Design list (see forwarded message below) Sam Marshall 
gave some good insight into the bug  and suggested that I contact you 
and report it. Can you please fix it?


Thanks,

Laura


---------- Forwarded Message ----------

Date: Monday, October 20, 2003 5:25 AM -0400

From: "[WD] digest" <owner-digest@webdesign-l.com>

To: digest@webdesign-l.com

Subject: [WD] digest V2 #1616


Since you don't have an infinite loop (none of your stylesheets have
@imports except the main one), I would say this is probably a validator
bug. Most likely the loop detection is failing because of one of two
features:


a) you have multiple imports in the <style> statement rather than in
different .css files and it is confused as it doesn't know a 'name' for
the style block .css 'file'.


or


b) your stylesheets have similar names until the last few characters


(Both of these would indicate a validator bug, I'm just making vague
guesses at why it might happen.)


You might want to make a copy of your files somewhere that they won't
change (so it's useful as a reference while fixing the bug) and submit
it in a bug report to the validator people. Unless I'm being thick,
there is no infinite loop anywhere in your page and even if there's
something else wrong with your CSS, the validator shouldn't report an
import loop when one doesn't exist.


- --sam

---------- End Forwarded Message ----------
Comment 1 Laura Carlson 2003-10-27 14:42:54 UTC
Yves Lafon, W3C has now fixed this bug.

It happened when the validator was modified to avoid import loops that 
was taking all the resources of the machine. 
Comment 2 Glen Prideaux 2003-12-10 23:17:39 UTC
Page attaches separate css files for print and screen media. Both print.css and
screen.css @import a common file base.css. There are no other @import
directives. CSSValidator reports "errorjava.lang.Exception: Import loop detected".

(Pages previously validated without error.)

Glen
Comment 3 Stefan Pottinger 2004-09-08 11:03:08 UTC
Hi!

I had the same problem as described above: two stylesheets (one for printing, 
one for the screen) that import the same stylesheet will produce the Exception.

My solution, as long as this bug exists, so the docs will validate:

<link rel="stylesheet" media="screen, print"   type="text/css" 
href="base.css" />
<link rel="stylesheet" media="screen"          type="text/css" 
href="screen.css" />
<link rel="stylesheet" media="print"           type="text/css" 
href="print.css" />


So base.css is included in the media's print and screen without adding the 
@import line in the Stylesheets print.css and screen.css. This is more like 
an "import" in the (x)html file itself and should work as well.

Perhaps it will help you...

Stefan
Comment 4 Etan Wexler 2004-10-05 20:30:35 UTC
The bug seems to be a simplistic definition of "loop". I suspect that the
algorithm at fault is as follows.

Repeat for each style sheet:
1. Record the style sheet's URI.
2. If the URI is the same as any URI recorded previously in this validation
session, raise an error.
3. Get the style sheet.
4. Validate the style sheet.

The following style sheet illustrates the validator's inability to handle a very
finite situation:

    @import "http://www.w3.org/StyleSheets/home.css";
    @import "http://www.w3.org/StyleSheets/home.css";

The validator's result:

http://jigsaw.w3.org/css-validator/validator?text=%40import+%22http%3A%2F%2Fwww.w3.org%2FStyleSheets%2Fhome.css%22%3B%40import+%22http%3A%2F%2Fwww.w3.org%2FStyleSheets%2Fhome.css%22%3B&usermedium=all
Comment 5 Etan Wexler 2004-10-27 13:00:18 UTC
*** Bug 754 has been marked as a duplicate of this bug. ***
Comment 6 Yves Lafon 2005-08-23 09:46:11 UTC
Please check that it is ok on http://qa-dev.w3.org:8001/css-validator/ the
"main" server will be updated later.