If you think a bug might affect users in the 57 release, please set the correct tracking and status flags for Release Management.

mozilla/firefox does not pull in external CSS

RESOLVED WORKSFORME

Status

()

Core
CSS Parsing and Computation
RESOLVED WORKSFORME
13 years ago
13 years ago

People

(Reporter: Patrick Tou, Assigned: dbaron)

Tracking

({testcase})

Trunk
x86
All
testcase
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments, 3 obsolete attachments)

(Reporter)

Description

13 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7) Gecko/20040614 Firefox/0.9
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7) Gecko/20040614 Firefox/0.9

Mozilla/Firefox does not pull in external CSS styles.
A javascript generated page attempts to link in an external CSS style, but the
styles are not applied.
A javascript generated page uses an internal CSS style and works.
A static page links in an external CSS style and works.

Reproducible: Always
Steps to Reproduce:
1. Create a page that uses javascript to generate HTML that pulls in external CSS.
2. The javascript generated page does not pull in the external CSS.
3.

Actual Results:  
Browser default behavior (no CSS) is used instead of external CSS page that is
supposed to be linked in.

Expected Results:  
Link in external CSS, apply styles to page being rendered.

Code Snippets: 3 files - main.html, static.html, body.css, 
**********************************************************************
* main.html
**********************************************************************
<html><head>
<script language="JavaScript">
<!--
function writeHtmlExternal()
{
    var buf = "";
    buf += "<html><head>\n";
    buf += "<link rel='stylesheet' id='styleLink' href='body.css'
type='text/css'>\n";
    buf += '</head>\n';
    buf += "<body>";
    buf += "This should be blue! (external CSS)"
    buf +="</body></html>";
   return buf;
}
function writeHtmlInternal()
{
    var buf = "";
    buf += "<html><head>\n";
    buf += '<style type="text/css">\n';
    buf += 'body{ color: #0000FF; }\n';
    buf += '</style>\n';
    buf += '</head>\n';
    buf += "<body>";
    buf += "This should be blue! (internal CSS)"
    buf +="</body></html>";
    return buf;
}
//-->
</script>
</head>
<frameset rows="50,50,50" frameborder=yes border=2>
	<frame name="static" src="static.html">
	<frame name="extcss" src="javascript:parent.writeHtmlExternal()">
	<frame name="intcss" src="javascript:parent.writeHtmlInternal()">
</frameset>
<body>
</body><html>

**********************************************************************
* static.html
**********************************************************************
<html><head>
<link rel='stylesheet' id='styleLink' href='body.css' type='text/css'>
</head>
<body>
This should be blue! (static page)
</body></html>

**********************************************************************
* body.css
**********************************************************************
body{ color: #0000FF; }
Could you attach a testcase, or could you put somewhere else a testcase which
shows the bug?
(Reporter)

Comment 2

13 years ago
Created attachment 151863 [details]
sample test case
(Reporter)

Comment 3

13 years ago
Created attachment 151864 [details]
same test case
(Reporter)

Comment 4

13 years ago
Created attachment 151865 [details]
same test case CSS

Updated

13 years ago
Keywords: testcase
(Reporter)

Comment 5

13 years ago
Verified in
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7) Gecko/20040616

Comment 6

13 years ago
wfm Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8a2) Gecko/20040628
Created attachment 151872 [details]
Working testcase

You had an error in your testcases, you were still linking your stylesheet to
'body.css', but this has to be
'http://bugzilla.mozilla.org/attachment.cgi?id=151865&action=view' for the
stylesheet file (the mime type isn't right, but that doesn't matter in this
case).
This is a good testcase, but this one works fine for me.

I see you did work with a relatively linked stylesheet: <link href='body.css'.
The frame has src="javascript:", so the base url is 'javascript:', which seems
to me correct. But IE seems to use the location of the parent frameset as base
url instead. So I'm beginning to think this is correct behavior of Mozilla. If
you would like to include an external stylesheet in this case, you should use a
absolute url.
Attachment #151863 - Attachment is obsolete: true
Attachment #151864 - Attachment is obsolete: true
Created attachment 151873 [details]
Working testcase reloaded

Oops, happening to me now also. The previous one was wrong. Sorry.
Attachment #151872 - Attachment is obsolete: true

Updated

13 years ago
Attachment #151865 - Attachment mime type: text/plain → text/css

Comment 9

13 years ago
Marking WORKSFORME. Please reopen if you still have this problem with attachment
151873. Thanks.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 13 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.