Closed Bug 266931 Opened 20 years ago Closed 20 years ago

In JavaScript HEX color values are changed to decimal rgb values

Categories

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

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 110762

People

(Reporter: bugzilla, Unassigned)

References

()

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; da-DK; rv:1.7.2) Gecko/20040803
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; da-DK; rv:1.7.2) Gecko/20040803

when assigning a background-color to an element in JavaScript in the format
#hex, the color are changed to the format rgb(dec,dec,dec)

i have a JavaScript, testing if the color has changed, and unfortunally it
reports true every time because of this

Reproducible: Always
Steps to Reproduce:
see this code:
<script type="text/javascript">
document.getElementById('colorbox').style.backgroundColor = "#abc"
document.writeln("The following lines are identical:<br />")
document.writeln("#abc<br />")
document.writeln(document.getElementById('colorbox').style.backgroundColor)
</script>

Actual Results:  
line 3 is different from line 2

Expected Results:  
line 3 should be the same as line 2
I don't think this is a bug... it just reports the current value in a
standardized format...

see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleDeclaration
"This interface is also used to provide a read-only access to the computed
values of an element. See also the ViewCSS interface."
Component: DOM: Level 0 → DOM: CSSOM
That's correct. The next revision of the CSSOM specification will be clarified
to REQUIRE that the color value is reported in the canonical rgb() format.

*** This bug has been marked as a duplicate of 110762 ***
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → DUPLICATE
may i suggest a better search facility in bugzilla? i started searching for
everything containing the words "color" and "JavaScript" and bug 110762
contained both words but was not on the list!
You need to log in before you can comment on or make changes to this bug.