Odd RGB color conversion of Hex Value in .backgroundColor attribute

RESOLVED DUPLICATE of bug 110762

Status

()

--
minor
RESOLVED DUPLICATE of bug 110762
15 years ago
15 years ago

People

(Reporter: lhf.kuro, Unassigned)

Tracking

({testcase})

Trunk
x86
Windows 2000
testcase
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

15 years ago
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)
(Reporter)

Comment 1

15 years ago
Created attachment 142021 [details]
Testcase

HTML source file to see what the problem is

Updated

15 years ago
Keywords: testcase

Comment 2

15 years ago
dup of bug 110762?

Comment 3

15 years ago
IMHO yes, marking as dupe of bug 110762.

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