/* * Copyright (c) 2022, the SerenityOS developers. * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include #include namespace Web::HTML { using HTMLOptionOrOptGroupElement = Variant, GC::Root>; using HTMLElementOrElementIndex = Variant, i32>; class HTMLOptionsCollection final : public DOM::HTMLCollection { WEB_PLATFORM_OBJECT(HTMLOptionsCollection, DOM::HTMLCollection); GC_DECLARE_ALLOCATOR(HTMLOptionsCollection); public: [[nodiscard]] static GC::Ref create(DOM::ParentNode& root, ESCAPING Function filter); virtual ~HTMLOptionsCollection() override; WebIDL::ExceptionOr set_value_of_indexed_property(u32, JS::Value) override; WebIDL::ExceptionOr set_length(WebIDL::UnsignedLong); WebIDL::ExceptionOr add(HTMLOptionOrOptGroupElement element, Optional before = {}); void remove(WebIDL::Long); WebIDL::Long selected_index() const; void set_selected_index(WebIDL::Long); private: HTMLOptionsCollection(DOM::ParentNode& root, ESCAPING Function filter); virtual void initialize(JS::Realm&) override; }; }