Closed Bug 279718 Opened 20 years ago Closed 20 years ago

@import within @media CSS block not being processed

Categories

(Core :: CSS Parsing and Computation, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: jwsoft, Assigned: dbaron)

References

()

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b) Gecko/20050116 Firefox/1.0+
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b) Gecko/20050116 Firefox/1.0+

Although Mozilla supports @import "test.css" screen; I've found it necessary to
wrap screen-specific CSS in @import screen {} blocks to preserve IE compatibility.

Although normal style rules in such a block are processed for screen display and
screen display only, an @import line within such a block is never carried out.

Reproducible: Always

Steps to Reproduce:
1. Load the test page (http://jack.mauveweb.co.uk/mozilla/mediaimport.html)
2. Observe black text
3. Note that the conditionally imported stylesheet contains a rule which should
make all paragraphs red

Actual Results:  
A paragraph of black text is displayed.

Expected Results:  
A paragraph of red text should have been displayed.

I'm almost certain this behaviour will be Hardware Platform: All and Operating
System: All, but I don't have the hardware to check that so I'm leaving it as
PC/XP for the moment.
http://w3.org/TR/CSS21/cascade.html#at-import

I guess this is INVALID. @import should precede any rules in the style sheets.
If you want a media specific @import you should use |@import url("foo") screen;|.
My problem with the @import screen approach, as I mentioned in the bug report,
is that I'm developing an intranet site for a company currently stuck with
Internet Explorer (which doesn't handle such @imports).

If this is definitely an invalid use of CSS rules (I wasn't certain from the
specs whether these conditional blocks counted as their own sub-stylesheet and
could thus include @imports provided they were on the first line of the block),
I'll have to use an additional <link> tag in every HTML page instead (which may
be the only option).
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.