Closed Bug 183724 Opened 22 years ago Closed 22 years ago

Consider the media attribute when picking the preferred style set [AltSS]

Categories

(Core :: CSS Parsing and Computation, defect)

x86
Windows 2000
defect
Not set
minor

Tracking

()

VERIFIED DUPLICATE of bug 125613

People

(Reporter: davidkolar, Assigned: dbaron)

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.2.1) Gecko/20021130
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.2.1) Gecko/20021130

For example:

<link href="print.css" rel="stylesheet" title="My Print Style" type="text/css"
media="print">
<link href="screen.css" rel="stylesheet" title="My Screen Style" type="text/css"
media="screen">

Only the second stylesheet should be used when browsing, because its "media"
attribute is set to "screen", whereas the first stylesheets "media" attribute is
set to "print". If no "media" attribute were set, then the styles in the second
sheet should override the styles in the first sheet when the same selectors are
used. 

Instead, Mozilla will always attempt to use the first stylesheet. You can
manually select the correct stylesheet under the View --> Use Style menu.

Reproducible: Always

Steps to Reproduce:
1. Create two linked stylesheets for your page
2. Give each link its own "title"

Actual Results:  
The first stylesheet is always selected.

Expected Results:  
Mozilla should honor the "media" attribute and select the media="screen"
stylesheet for displaying pages on a computer screen.
I think this is a duplicate but I can't find the other bug.
Whiteboard: DUPEME
Uh, this is not a bug. According to the HTML spec, the media attribute is not
used when picking the preferred stylesheet. It's silly, but that's not our fault.
Severity: major → minor
Summary: Using the "title" attribute in linked stylesheets within the <head> causes incorrect sheets to be used → Consider the media attribute when picking the preferred style set [AltSS]
anything filed in bugzilla is a "bug" :)

is bug 125613 the one?
It doesn't seem correct that Mozilla should render the page differently based on
the fact that the style link is using a "title" attribute.

If the title attribute is not used within the link tag, Mozilla will load all
the linked styles and honor their media attributes.

With the title attribute set to some text in the link tag, Mozilla will load and
use the stylesheet which is linked first and ignore the media attribute. It also
doesn't seem to even read linked stylesheets which follow the first one.
Michael, the bug you refer to in comment #3 is setting me straight. Now I see
that my problem is that I didn't understand that setting the "title" attribute
changes the stylesheet from -persistent- to -preferred-.
( http://www.w3.org/TR/html4/present/styles.html#h-14.3.2 )

Mozilla is doing what it is supposed to be doing. It seems like you (David B.,
Ian, and Michael) have been down this road before. Sorry to bring this all up
again, but I was searching in the wrong places for past bug reports. 

I was really suprised to see my pages appear totally different in Mozilla than
in IE 6, but this is my fault for not understanding the huge change that can
occur when adding the "title" attribute. (i.e., my stylesheet stopped being used). 

So now I don't think that there is a bug at all. Should this be changed to
"invalid"?

thanks for the followup. now you've confirmed that the other bug is the same
issue (I didn't look in detail), the right thing to do is mark this as a
duplicate, so I'll do that.

*** This bug has been marked as a duplicate of 125613 ***
Status: UNCONFIRMED → RESOLVED
Closed: 22 years ago
Resolution: --- → DUPLICATE
Whiteboard: DUPEME
good good
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.