Closed Bug 710561 Opened 14 years ago Closed 14 years ago

getComputedStyle returns wrong color value for select option tag

Categories

(Core :: Layout: Form Controls, defect)

8 Branch
x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: valent.novem, Unassigned)

References

()

Details

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.
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
Closed: 14 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.