serenity
serenity copied to clipboard
LibWeb: Allow selecting select options without value
Currently the <select>
dropdown ipc uses the option value attr to find which option is selected. This won't work when options don't have values or when multiple options have the same value. Also the SelectItem
contained so weird recursive structures that are imposible to create with HTML. So I refactored SelectItem
as a variant, and gave the options a unique id. That id is send back to HTMLSelectElement
so it can find out exactly which option element is selected.
So now you can select the items in this select for example:
<select>
<option value="">Lorem ipsum dolor sit amet.</option>
<option value="">Beatae minus sunt quae dolor.</option>
<option value="">Inventore nulla doloremque corrupti in?</option>
<option value="">Laudantium, error. Beatae, itaque sit!</option>
<option value="">Adipisci a harum dolores molestiae!</option>
</select>
I also updated the styling of a <option>
in a <optgroup>
a bit by giving the label some indent like other browsers do. And I fixed a bug where the disabled
attr was ignored.