Options with display:none should still be selectable with selectedIndex. https://html.spec.whatwg.org/multipage/form-elements.html#ask-for-a-reset See attached demo.
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/91be5c7c64cfd8f87dd8e98e749c2f32ab4b7bd6 commit 91be5c7c64cfd8f87dd8e98e749c2f32ab4b7bd6 Author: Rune Lillesveen <futhark@chromium.org> Date: Fri Mar 23 14:50:52 2018 Don't skip display:none options finding selectable options. This means we can also assume a null ComputedStyle on options means they are display:none. That is a pre-requisite for fixing issue 822581 . Bug: 824754 Change-Id: Ia8a400ec8eed9ecb9a85d2c93c354841ad721492 Reviewed-on: https://chromium-review.googlesource.com/975604 Commit-Queue: Rune Lillesveen <futhark@chromium.org> Reviewed-by: Kent Tamura <tkent@chromium.org> Cr-Commit-Position: refs/heads/master@{#545443} [modify] https://crrev.com/91be5c7c64cfd8f87dd8e98e749c2f32ab4b7bd6/third_party/WebKit/LayoutTests/external/wpt/html/semantics/forms/the-select-element/selected-index.html [modify] https://crrev.com/91be5c7c64cfd8f87dd8e98e749c2f32ab4b7bd6/third_party/WebKit/Source/core/html/forms/HTMLOptionElement.cpp [modify] https://crrev.com/91be5c7c64cfd8f87dd8e98e749c2f32ab4b7bd6/third_party/WebKit/Source/core/html/forms/HTMLSelectElement.cpp
Comment 1 by futhark@chromium.org
, Mar 22 2018