RESOLVED WONTFIX 43887
HTMLSelectElement.size defaults to 0
https://bugs.webkit.org/show_bug.cgi?id=43887
Summary HTMLSelectElement.size defaults to 0
Mike Taylor
Reported 2010-08-11 16:02:05 PDT
Per the HTML5 spec, a select element without a required attribute should have its size attribute default to 1. (http://www.whatwg.org/specs/web-apps/current-work/complete.html#the-select-element) `The size attribute gives the number of options to show to the user. The size attribute, if specified, must have a value that is a valid non-negative integer greater than zero. If the multiple attribute is present, then the size attribute's default value is 4. If the multiple attribute is absent, then the size attribute's default value is 1.` Current builds default to 0. Code used in test case (http://jsbin.com/aqana/2/edit): var select = document.createElement('select'); function testSize(el) { return el.size == 1; } testSize(select); // false
Attachments
Patch (6.05 KB, patch)
2010-12-02 03:30 PST, Dai Mikurube
ap: review-
Alexey Proskuryakov
Comment 1 2010-08-12 02:05:22 PDT
What do other browsers do? Firefox seems to match WebKit, but I didn't test IE.
Mike Taylor
Comment 2 2010-08-12 06:31:48 PDT
Hmm, it appears that Webkit, Firefox 4 and IE8 all do the same thing, that is set @size to 0. I thought Gecko was doing something else last night, but I was mistaken.
Alexey Proskuryakov
Comment 3 2010-08-12 07:33:23 PDT
Would you be willing to report a bug against HTML5? You can file it at <http://www.w3.org/Bugs/Public/enter_bug.cgi?product=HTML%20WG>, or simply e-mail the working group.
Mike Taylor
Comment 4 2010-08-12 14:59:40 PDT
Dai Mikurube
Comment 5 2010-12-02 01:23:13 PST
(In reply to comment #4) Reading the message on the working group, it looks better to change the default size to 1 or 4. > http://lists.w3.org/Archives/Public/public-html/2010Aug/0126.html I'll be starting to work on this since it blocks the bug 50380.
Dai Mikurube
Comment 6 2010-12-02 03:30:20 PST
Mounir Lamouri
Comment 7 2010-12-02 03:33:49 PST
FYI, we did this change for Gecko and some sites broke [1]. So, we've reverted to returning 0. By the way, the specs require to return 1 as a default value even if multiple is set (but I agree this non-sense). There is a bug filed for that [2]. [1] https://bugzilla.mozilla.org/show_bug.cgi?id=603141 [2] http://www.w3.org/Bugs/Public/show_bug.cgi?id=11162
Alexey Proskuryakov
Comment 8 2010-12-02 09:04:16 PST
Comment on attachment 75366 [details] Patch So I guess that we don't want to do this.
Kent Tamura
Comment 9 2010-12-02 19:13:51 PST
(In reply to comment #8) > (From update of attachment 75366 [details]) > So I guess that we don't want to do this. I agree. We shouldn't change this for now.
Dai Mikurube
Comment 10 2010-12-02 19:16:57 PST
Ok, let's close it.
Note You need to log in before you can comment on or make changes to this bug.