Closed Bug 104538 Opened 23 years ago Closed 23 years ago

stylesheets linked with titles are loaded as alt stylesheet

Categories

(Core :: DOM: CSS Object Model, defect)

x86
Windows 98
defect
Not set
normal

Tracking

()

VERIFIED DUPLICATE of bug 97033

People

(Reporter: homeric1245, Assigned: jst)

Details

Attachments

(1 file)

From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:0.9.4) Gecko/20010913
BuildID:    2001091303

The page http://homeric.by.ru/links/ has two LINK tags that link two different
stylesheets. Only the first stylesheet (homeric.css) is used by the browser, the
second (links.css) is ignored. 
If the tags are swapped, the other stylesheet (links.css) comes into effect, but
the first (homeric.css) is ignored.
The page and the stylesheets were validated by me at W3C. The page is XHTML 1.0
Strict, the CSS files are CSS2.
If one of the TITLE attributes is removed, both stylesheets are in effect.

Reproducible: Always
Steps to Reproduce:
1. Create two stylesheets and a page that uses style1.css and style2.css
2. Load the page into the browser
3. Swap the LINK tags and reload the page
4. Remove TITLE attribute from first tag and reload the page
5. Put the TITLE attribute back into the first LINK tag, remove from the second
LINK tag, reload the page


Actual Results:  If both LINK tags have TITLE attributes, only the stylesheet
that is placed first is applied. If one of the LINK tags does not have a TITLE
attribute, both stylesheets apply.


Expected Results:  Apply both stylesheets regardless of the presence or absence
of TITLE attributes in LINK tags that link the stylesheets

Sample Files

=== begin index1.htm ===
<?xml version="1.0" encoding="windows-1251"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" type="text/css" href="style1.css" title="First Stylesheet" />
<link rel="stylesheet" type="text/css" href="style2.css" title="Second
Stylesheet" />
<title>Two LINK tags</title>
</head>
<body>
<h1 class="stylefromstyle1">Style from style1.css</h1>
<h1 class="stylefromstyle2">Style from style2.css</h1>
</body>
</html>
=== end index1.htm ===

=== begin index2.htm ===
<?xml version="1.0" encoding="windows-1251"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" type="text/css" href="style2.css" title="Second
Stylesheet" />
<link rel="stylesheet" type="text/css" href="style1.css" title="First Stylesheet" />
<title>Two LINK tags</title>
</head>
<body>
<h1 class="stylefromstyle1">Style from style1.css</h1>
<h1 class="stylefromstyle2">Style from style2.css</h1>

</body>
</html>
=== end index2.htm ===

=== begin index3.htm ===
<?xml version="1.0" encoding="windows-1251"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" type="text/css" href="style2.css" />
<link rel="stylesheet" type="text/css" href="style1.css" title="First Stylesheet" />
<title>Two LINK tags</title>
</head>
<body>
<h1 class="stylefromstyle1">Style from style1.css</h1>
<h1 class="stylefromstyle2">Style from style2.css</h1>

</body>
</html>
=== end index3.htm ===

=== begin index4.htm ===
<?xml version="1.0" encoding="windows-1251"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" type="text/css" href="style2.css" title="Second
Stylesheet" />
<link rel="stylesheet" type="text/css" href="style1.css" />
<title>Two LINK tags</title>
</head>
<body>
<h1 class="stylefromstyle1">Style from style1.css</h1>
<h1 class="stylefromstyle2">Style from style2.css</h1>

</body>
</html>
=== end index4.htm ===

=== begin style1.css ===
h1.stylefromstyle1 {background-color: #000000; color: #ffffff; }
=== end style1.css ===

=== begin style2.css ===
h1.stylefromstyle2 {background-color: #ffffcc; color: #ff0000; }
=== end style2.css ===
I see this, confirming. 2001101203, Win 98

I thought this might go under Parse, but I'm not quite sure.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Sorry but this is invalid.  This is by design.

------- Additional Comments From David Baron 2001-08-26 08:49 -------
Our behavior is correct.  See
http://www.w3.org/TR/html4/present/styles.html#h-14.3 .

In particular, see the following two statements in 14.3.2:

"          * To make a style sheet persistent, set the rel attribute to
"stylesheet" and don't set the title attribute.
          * To make a style sheet preferred, set the rel attribute to
"stylesheet" and name the style sheet with the title attribute.
          * To specify an alternate style sheet, set the rel attribute to
"alternate stylesheet" and name the style sheet with the title attribute."

"If two or more LINK elements specify a preferred style sheet, the first one
takes precedence."

Marking bug as INVALID.  See the tests at
http://www.bath.ac.uk/~py8ieh/internet/importtest/ for testcases.



*** This bug has been marked as a duplicate of 97033 ***
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → DUPLICATE
VERIFIED DUPLICATE INVALID
Status: RESOLVED → VERIFIED
Summary: If there is two LINK tags with TITLE attributes, only the first stylesheet is used → stylesheets linked with titles are loaded as alt stylesheet
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: