getComputedStyle returns wrong color value for select option tag

RESOLVED INVALID

Status

()

Core
Layout: Form Controls
RESOLVED INVALID
6 years ago
6 years ago

People

(Reporter: Valent, Unassigned)

Tracking

8 Branch
x86
Windows XP
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(URL)

(Reporter)

Description

6 years ago
User Agent: Mozilla/5.0 (Windows NT 5.1; rv:8.0) Gecko/20100101 Firefox/8.0
Build ID: 20111104165243

Steps to reproduce:

I have select with colored options:
<select>
    <option style="color: #ff0000;">Hello</option>
    <option style="color: #00ff00;">world</option>
</select>

I want to get color of an option:
var el = $('select:first').children(':first')[0];
alert('Computed style: ' + getComputedStyle(el, null)['color'] +
     '\nDirect style: ' + el.style['color']);

Firefox shows different values.


Actual results:

Here is testcase.
http://jsfiddle.net/Kt3KV/1/
It works correctly in other browsers.
(Reporter)

Updated

6 years ago
Component: General → Layout: Form Controls
Product: Firefox → Core
QA Contact: general → layout.form-controls
The computed color for the currently-selected option is not the same as your inline set color, because there are other styles affecting it.  If you really want your inline style color instead of the _computed_ color, don't ask for the computed color.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.