Closed Bug 235279 Opened 20 years ago Closed 20 years ago

Odd RGB color conversion of Hex Value in .backgroundColor attribute

Categories

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

x86
Windows 2000
defect
Not set
minor

Tracking

()

RESOLVED DUPLICATE of bug 110762

People

(Reporter: lhf.kuro, Unassigned)

Details

(Keywords: testcase)

Attachments

(1 file)

User-Agent:       
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; fr-FR; rv:1.6) Gecko/20040113

<!-- Just try this (same behavior with last nightly build 1.7??? - sorry 'forgot
the exact number): -->
<HTML><HEAD><TITLE></TITLE><SCRIPT language=javascript><!--
//cross-browser getElementById() equiv
function TheObj(id){var
d,o;d=document;if(d.all)o=d.all[id];if(!o&&d.getElementById)o=d.getElementById(id);return
o}

//defines color
function SetColor(id){var obj,color; obj = TheObj(id); color = '#aaaaaa';
if(obj.style){
  obj.style.backgroundColor = color;
}else{
  obj.backgroundColor = color;
}
}

//displays returned color value
function GetColor(obj){var color;color = (obj.style)? obj.style.backgroundColor
: obj.backgroundColor;
        alert('this element color is : '+ color);
}//--></SCRIPT></HEAD>

<BODY onload="SetColor('mytd')">
<TABLE border=0 cellpadding=0 cellspacing=1>
 <TR>
   <TD id='mytd' width=13 onclick="GetColor(this)">&nbsp;</TD>
 </TR>
<TABLE>
</BODY>
</HTML>

Reproducible: Always
Steps to Reproduce:
1. Just make an HTML file with the provided HTML Code
2. Open it with both Mozilla and other browsers
3. Click on the grey box that shows up in the page

Actual Results:  
alert() box displays "...color is : rgb( 170, 170, 170)"

Expected Results:  
alert() box should have displayed "...color is : #aaaaaa" instead

Annoying bug if you want to write a DHTML "color picker" tool for example... 

(tough you can find other ways with .js code to build one even with this strange
results)
Attached file Testcase
HTML source file to see what the problem is
Keywords: testcase
dup of bug 110762?
IMHO yes, marking as dupe of bug 110762.

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

Attachment

General

Creator:
Created:
Updated:
Size: