Open Bug 1300282 Opened 9 years ago Updated 3 years ago

The Option constructor doesn't return expected option element

Categories

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

50 Branch
defect

Tracking

()

People

(Reporter: zbinlin, Unassigned)

References

()

Details

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:50.0) Gecko/20100101 Firefox/50.0 Build ID: 20160830141501 Steps to reproduce: User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:50.0) Gecko/20100101 Firefox/50.0 test case: ```javascript var opt = new Option("foo", 0, true); console.log(opt.selected); ``` Actual results: actual output: true Expected results: expected output: false
Component: Untriaged → DOM
Product: Firefox → Core
Seems like there's a number of issues related to the handling of optional arguments here. For example, in addition to the issue in comment 0, all these fail: ``` assert_equals((new Option(undefined, "value")).value, "value"); assert_true((new Option(undefined, undefined, true)).defaultSelected); assert_true((new Option(undefined, undefined, undefined, true)).selected); assert_false((new Option("")).hasChildNodes()); ```
Status: UNCONFIRMED → NEW
Ever confirmed: true
Priority: -- → P3
Additionally, setting the optional argument defaultSelected to true in the constructor sets the selectedness to true as well, which goes against the spec: https://html.spec.whatwg.org/multipage/forms.html#concept-option-selectedness
See Also: → 1365399
See Also: → 1365402
See Also: 1365402
Component: DOM → DOM: Core & HTML
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.