Serenity Operating System
at master 33 lines 1.1 kB view raw
1/* 2 * Copyright (c) 2022, the SerenityOS developers. 3 * 4 * SPDX-License-Identifier: BSD-2-Clause 5 */ 6 7#pragma once 8 9#include <AK/Variant.h> 10#include <LibWeb/DOM/HTMLCollection.h> 11#include <LibWeb/WebIDL/ExceptionOr.h> 12 13namespace Web::HTML { 14 15using HTMLOptionOrOptGroupElement = Variant<JS::Handle<HTMLOptionElement>, JS::Handle<HTMLOptGroupElement>>; 16using HTMLElementOrElementIndex = Variant<JS::Handle<HTMLElement>, i32>; 17 18class HTMLOptionsCollection final : public DOM::HTMLCollection { 19 WEB_PLATFORM_OBJECT(HTMLOptionsCollection, DOM::HTMLCollection); 20 21public: 22 static WebIDL::ExceptionOr<JS::NonnullGCPtr<HTMLOptionsCollection>> create(DOM::ParentNode& root, Function<bool(DOM::Element const&)> filter); 23 virtual ~HTMLOptionsCollection() override; 24 25 WebIDL::ExceptionOr<void> add(HTMLOptionOrOptGroupElement element, Optional<HTMLElementOrElementIndex> before = {}); 26 27private: 28 HTMLOptionsCollection(DOM::ParentNode& root, Function<bool(DOM::Element const&)> filter); 29 30 virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; 31}; 32 33}