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)
Tracking
()
NEW
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
Updated•9 years ago
|
Component: Untriaged → DOM
Product: Firefox → Core
Comment 1•9 years ago
|
||
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());
```
Updated•9 years ago
|
Priority: -- → P3
Comment 2•9 years ago
|
||
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
| Assignee | ||
Updated•7 years ago
|
Component: DOM → DOM: Core & HTML
Updated•3 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•