mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-26 14:28:49 +00:00
LibWeb: Implement reset algorithm for HTMLSelectElement
This commit is contained in:
parent
de44e0faf5
commit
b55c9f36dc
Notes:
sideshowbarker
2024-07-17 06:39:26 +09:00
Author: https://github.com/srikavin
Commit: b55c9f36dc
Pull-request: https://github.com/SerenityOS/serenity/pull/16631
2 changed files with 16 additions and 0 deletions
|
@ -90,6 +90,20 @@ Vector<JS::Handle<HTMLOptionElement>> HTMLSelectElement::list_of_options() const
|
|||
return list;
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/form-elements.html#the-select-element:concept-form-reset-control
|
||||
void HTMLSelectElement::reset_algorithm()
|
||||
{
|
||||
// The reset algorithm for select elements is to go through all the option elements in the element's list of options,
|
||||
for (auto const& option_element : list_of_options()) {
|
||||
// set their selectedness to true if the option element has a selected attribute, and false otherwise,
|
||||
option_element->m_selected = option_element->has_attribute(AttributeNames::selected);
|
||||
// set their dirtiness to false,
|
||||
option_element->m_dirty = false;
|
||||
// and then have the option elements ask for a reset.
|
||||
option_element->ask_for_a_reset();
|
||||
}
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/form-elements.html#dom-select-selectedindex
|
||||
int HTMLSelectElement::selected_index() const
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue