Skip to content

Commit

Permalink
Don't skip display:none options finding selectable options.
Browse files Browse the repository at this point in the history
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}
  • Loading branch information
Rune Lillesveen authored and chromium-wpt-export-bot committed Mar 23, 2018
1 parent a1ec330 commit 89a7b39
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions html/semantics/forms/the-select-element/selected-index.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@
<option></option>
<option selected></option>
</select>

<select id=display-none>
<option style="display:none"></option>
<option></option>
</select>
</form>

<script>
Expand Down Expand Up @@ -100,4 +105,19 @@
form.reset();
assertSelectedIndex(select, 1);
}, "set and reset (HTMLOptionsCollection)");

test(function () {
var select = document.getElementById('display-none');
assertSelectedIndex(select, 0);
}, "get display:none");

test(function () {
var select = document.getElementById('display-none');
select.offsetTop; // force rendering
assertSelectedIndex(select, 0);
select.options[1].selected = true;
assertSelectedIndex(select, 1);
select.options[1].selected = false;
assertSelectedIndex(select, 0);
}, "reset to display:none");
</script>

0 comments on commit 89a7b39

Please sign in to comment.