2020-08-01 03:07:00 +01:00
|
|
|
/*
|
2021-04-28 22:46:44 +02:00
|
|
|
* Copyright (c) 2020, the SerenityOS developers.
|
2021-04-20 22:52:55 +02:00
|
|
|
* Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
|
2020-08-01 03:07:00 +01:00
|
|
|
*
|
2021-04-22 01:24:48 -07:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-08-01 03:07:00 +01:00
|
|
|
*/
|
|
|
|
|
2021-04-20 22:52:55 +02:00
|
|
|
#include <LibWeb/HTML/HTMLFormElement.h>
|
2022-03-16 13:08:12 +01:00
|
|
|
#include <LibWeb/HTML/HTMLOptionElement.h>
|
2020-08-01 03:07:00 +01:00
|
|
|
#include <LibWeb/HTML/HTMLSelectElement.h>
|
|
|
|
|
|
|
|
namespace Web::HTML {
|
|
|
|
|
2022-02-18 21:00:52 +01:00
|
|
|
HTMLSelectElement::HTMLSelectElement(DOM::Document& document, DOM::QualifiedName qualified_name)
|
2021-10-14 16:18:49 +01:00
|
|
|
: FormAssociatedElement(document, move(qualified_name))
|
2020-08-01 03:07:00 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2022-03-14 13:21:51 -06:00
|
|
|
HTMLSelectElement::~HTMLSelectElement() = default;
|
2020-08-01 03:07:00 +01:00
|
|
|
|
2022-03-16 13:08:12 +01:00
|
|
|
// https://html.spec.whatwg.org/multipage/form-elements.html#dom-select-options
|
|
|
|
RefPtr<HTMLOptionsCollection> const& HTMLSelectElement::options()
|
|
|
|
{
|
|
|
|
if (!m_options) {
|
|
|
|
m_options = HTMLOptionsCollection::create(*this, [](DOM::Element const& element) {
|
|
|
|
// https://html.spec.whatwg.org/multipage/form-elements.html#concept-select-option-list
|
|
|
|
// The list of options for a select element consists of all the option element children of
|
|
|
|
// the select element, and all the option element children of all the optgroup element children
|
|
|
|
// of the select element, in tree order.
|
|
|
|
return is<HTMLOptionElement>(element);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
return m_options;
|
|
|
|
}
|
|
|
|
|
2020-08-01 03:07:00 +01:00
|
|
|
}
|