New issue
Advanced search Search tips

Issue 599008 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Mar 2016
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 2
Type: Bug



Sign in to add a comment

Changing 'multiple' state of SELECT element should reset to default selection

Project Member Reported by tkent@chromium.org, Mar 30 2016

Issue description

Version: Confirmed on 49 and 51
OS: All

What steps will reproduce the problem?
(1) Load the following HTML, and watch the page
<!DOCTYPE html>
<select id=m multiple>
  <option>a</option>
  <option selected>b</option>
  <option selected>c</option>
</select>
<script>
var m = document.querySelector('#m');
m.removeAttribute('multiple');
document.write('Number of selected options: ' + m.selectedOptions.length);
</script>

What is the expected output?
"Number of selected options: 1' is shown.

What do you see instead?
"Number of selected options: 2' is shown.


Please use labels and text to provide additional information.
Safri, Edge and Firefox show '1'.



 

Comment 1 by tkent@chromium.org, Mar 30 2016

Status: Started (was: Assigned)
Project Member

Comment 2 by bugdroid1@chromium.org, Mar 31 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/ed6cd6b785c97d4a678c262bbf5e62bf46e5a2e8

commit ed6cd6b785c97d4a678c262bbf5e62bf46e5a2e8
Author: tkent <tkent@chromium.org>
Date: Thu Mar 31 09:06:55 2016

Fix problems on changing 'multiple' state SELECT element to 'single' state.

This CL fixes two problems.

* Setting 'multiple' IDL attribute to false and removing 'multiple' content
  attribute had different behavior.
  They should be identical.  This CL removes HTMLSelectElement::setMultiple(), and
  add [Reflect] to 'multiple' IDL attribute.

* If multiple SELECT without selected OPTIONs is changed to single, we should run
  resetToDefaultSelection().
  All other browsers agree with this behavior.

BUG= 599008 

Review URL: https://codereview.chromium.org/1838183003

Cr-Commit-Position: refs/heads/master@{#384226}

[modify] https://crrev.com/ed6cd6b785c97d4a678c262bbf5e62bf46e5a2e8/third_party/WebKit/LayoutTests/fast/forms/select/change-multiple-preserve-selection-expected.txt
[modify] https://crrev.com/ed6cd6b785c97d4a678c262bbf5e62bf46e5a2e8/third_party/WebKit/LayoutTests/fast/forms/select/change-multiple-preserve-selection.html
[modify] https://crrev.com/ed6cd6b785c97d4a678c262bbf5e62bf46e5a2e8/third_party/WebKit/LayoutTests/fast/forms/select/select-ask-for-reset.html
[modify] https://crrev.com/ed6cd6b785c97d4a678c262bbf5e62bf46e5a2e8/third_party/WebKit/Source/core/html/HTMLSelectElement.cpp
[modify] https://crrev.com/ed6cd6b785c97d4a678c262bbf5e62bf46e5a2e8/third_party/WebKit/Source/core/html/HTMLSelectElement.h
[modify] https://crrev.com/ed6cd6b785c97d4a678c262bbf5e62bf46e5a2e8/third_party/WebKit/Source/core/html/HTMLSelectElement.idl

Comment 3 by tkent@chromium.org, Mar 31 2016

Labels: M-51
Status: Fixed (was: Started)

Sign in to add a comment