Closed Bug 253440 Opened 20 years ago Closed 20 years ago

HTML pages containing rgb values for body's bgcolor attribute displays dark green background, rendering page unreadable

Categories

(Core :: DOM: HTML Parser, defect)

x86
Windows 2000
defect
Not set
normal

Tracking

()

VERIFIED DUPLICATE of bug 121738

People

(Reporter: baboin, Unassigned)

Details

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8a3) Gecko/20040726 MultiZilla/1.6.4.0b
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8a3) Gecko/20040726 MultiZilla/1.6.4.0b

The following valid 4.01 Transitional HTML shows how Mozilla (up to 2004-07-26's
nightly build) badly interprets the deprecated background color tag.  Mozilla
renders this page with a dark text on black or dark green background instead of
a silvery-grey colour that this particular color code example represents:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Management Page</title>
</head>
<body bgcolor="rgb(229, 229, 229);">
Testing testing testing
</body>
</html>

(Additional edited comment From Martijn Wargers follows)

This is also not allowed inside a bgcolor attribute, see bug 150214.  However,
Mozilla doesn't seem to ignore the value but instead draws a dark green
background color for the body. I think that's a valid bug.

See also bug 150214, why rgb values aren't allowed.



Reproducible: Always
Steps to Reproduce:
Paste the example HTML code noted above into a file and load in Mozilla

Actual Results:  
Page rendered unreadable

Expected Results:  
Judging from Martin's comments, I imagine Mozilla should simply ignore the
unsupported RGB code and not show any background colour.

The workaround is to set Mozilla to "Use my chosen colors, ignoring the colors
and background image specified" - see menu "Edit >> Preferences >> Appearance >>
Colors".  

This isn't a very good workaround since you don't want to do this for every
wonky page that uses this unsupported RGB(xxx,yyy,zzz) style, unless you have
the PrefBar installed and then you can just uncheck the "Colors" checkbox. 
Because many people don't use PrefBar, I'm setting this bug's severity as
"Normal - it should be fixed" instead of "Minor".
The "background" attribute is parsed as a hex color string.  There are existing
bugs on this process not being _quite_ identical to IE's for cases when it's not
a valid hex string....
Whiteboard: DUPEME
Attached file HTML testcase
Open the attached HTML file in your fixed Mozilla; you should be able to read
the text and the background should be white...
(In reply to comment #1)
> The "background" attribute is parsed as a hex color string.  There are existing
> bugs on this process not being _quite_ identical to IE's for cases when it's not
> a valid hex string....

I couldn't find any bugs (I did so the usual search for dupes beforehand).  At
any rate, I'd submit that we aren't interested in copying any particular IE
reaction to invalid colour hex strings - let's just ignore it in the parser and
display a white background...
This isn't handled in the parser, and we can't just ignore it; a lot of pages
rely on such invalid strings and IE and NS4 render them identically...  Marking
dup of the bug on this issue.

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

Attachment

General

Creator:
Created:
Updated:
Size: