Closed Bug 659596 Opened 13 years ago Closed 13 years ago

option.label should be reflected like option.value

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

VERIFIED FIXED
mozilla7

People

(Reporter: mounir, Assigned: mounir)

References

()

Details

(Keywords: dev-doc-complete)

Attachments

(1 file)

Currently, option.value and option.label reflection are really different. Having them behaving the same way would be saner and very likely, the web compat way would be to have option.label behaving the same way as option.value.
Attached patch Patch v1Splinter Review
Having this pushed soon in the release cycle will help us catch any potential regressions.
Assignee: nobody → mounir.lamouri
Status: NEW → ASSIGNED
Attachment #535023 - Flags: review?(Olli.Pettay)
Whiteboard: [needs review]
Comment on attachment 535023 [details] [diff] [review]
Patch v1

The change makes a lot of sense, but what do other browsers do?
If all the other browsers have the spec'ed behavior, and have had that
for years, I don't think we should change this.
r+ for that code though.
Attachment #535023 - Flags: review?(Olli.Pettay) → review+
Hixie told in the spec bug that he wrote this part of the spec that way for retro-compatibility and he would be ok to make this consistent if there were no compat issues involved. I believe we can try that.

IE6 does reflect value and label IDL attributes with the content attribute. So does the last version of Presto.
Webkit, Gecko and IE9 do follow the specs (IOW, only reflect label with the content attribute and value defaults to textContent if the content attribute isn't set).
Gecko has implemented the .value behavior since 2002 (bug 162368).
Whiteboard: [needs review]
Comment on attachment 535023 [details] [diff] [review]
Patch v1

Asking a sr to make sure it's ok to push this change and ask for a spec change after that.
Attachment #535023 - Flags: superreview?(bzbarsky)
Comment on attachment 535023 [details] [diff] [review]
Patch v1

sr=me, but please fix the comment:

s/fallbacks/falls back/ (and do we really fall back to .textContent, or is there whitespace strippting going on?)

s/valued content/ ????? / (what is this trying to say?)

s/method fallback/method falls back/

In general, mayb just nix the first sentence of the comment?
Attachment #535023 - Flags: superreview?(bzbarsky) → superreview+
Flags: in-testsuite+
Whiteboard: [fixed in cedar]
Pushed:
http://hg.mozilla.org/mozilla-central/rev/846bef26a8e6
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Whiteboard: [fixed in cedar]
Target Milestone: --- → mozilla7
I apologize for asking, but the spec-speak here is leaving me confused as to how the behavior of option.label has changed for web devs. Can anyone clarify?
Verified fixed on:
Mozilla/5.0 (Windows NT 6.1; rv:7.0) Gecko/20100101 Firefox/7.0
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:7.0) Gecko/20100101 Firefox/7.0
Mozilla/5.0 (X11; Linux i686; rv:7.0) Gecko/20100101 Firefox/7.0
Mozilla/5.0 (Windows NT 5.1; rv:7.0) Gecko/20100101 Firefox/7.0
Build ID: 20110902161802

The bug was verified using the test referred in the link from comment #6 (test_bug659596.html), which has passed.
Status: RESOLVED → VERIFIED
(In reply to Eric Shepherd [:sheppy] from comment #8)
> Documentation updated:
> 
> https://developer.mozilla.org/en/HTML/Element/option
> https://developer.mozilla.org/en/DOM/HTMLOptionElement
> 
> And mentioned on Firefox 7 for developers.

FYI, the notes in the two articles were incorrect. I've updated them now.

Sebastian
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: