2022-03-16 12:58:28 +01:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2022, the SerenityOS developers.
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2022-03-21 20:02:40 -04:00
|
|
|
#include <AK/Variant.h>
|
2022-03-16 12:58:28 +01:00
|
|
|
#include <LibWeb/DOM/HTMLCollection.h>
|
2022-09-25 17:03:42 +01:00
|
|
|
#include <LibWeb/WebIDL/ExceptionOr.h>
|
2022-03-16 12:58:28 +01:00
|
|
|
|
|
|
|
namespace Web::HTML {
|
|
|
|
|
2022-08-28 13:42:07 +02:00
|
|
|
using HTMLOptionOrOptGroupElement = Variant<JS::Handle<HTMLOptionElement>, JS::Handle<HTMLOptGroupElement>>;
|
|
|
|
using HTMLElementOrElementIndex = Variant<JS::Handle<HTMLElement>, i32>;
|
2022-03-21 20:02:40 -04:00
|
|
|
|
2022-03-16 12:58:28 +01:00
|
|
|
class HTMLOptionsCollection final : public DOM::HTMLCollection {
|
2022-09-01 20:50:16 +02:00
|
|
|
WEB_PLATFORM_OBJECT(HTMLOptionsCollection, DOM::HTMLCollection);
|
2022-03-16 12:58:28 +01:00
|
|
|
|
2022-09-01 20:50:16 +02:00
|
|
|
public:
|
|
|
|
static JS::NonnullGCPtr<HTMLOptionsCollection> create(DOM::ParentNode& root, Function<bool(DOM::Element const&)> filter);
|
|
|
|
virtual ~HTMLOptionsCollection() override;
|
2022-03-16 12:58:28 +01:00
|
|
|
|
2022-09-25 17:03:42 +01:00
|
|
|
WebIDL::ExceptionOr<void> add(HTMLOptionOrOptGroupElement element, Optional<HTMLElementOrElementIndex> before = {});
|
2022-03-21 20:02:40 -04:00
|
|
|
|
2022-09-01 20:50:16 +02:00
|
|
|
private:
|
2022-03-16 12:58:28 +01:00
|
|
|
HTMLOptionsCollection(DOM::ParentNode& root, Function<bool(DOM::Element const&)> filter);
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|