1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:48:10 +00:00

LibWeb: Implement HTMLOptionsCollection.add()

This commit is contained in:
Timothy Flynn 2022-03-21 20:02:40 -04:00 committed by Andreas Kling
parent 5133491714
commit ff9856a214
3 changed files with 51 additions and 1 deletions

View file

@ -6,10 +6,15 @@
#pragma once
#include <AK/Variant.h>
#include <LibWeb/DOM/ExceptionOr.h>
#include <LibWeb/DOM/HTMLCollection.h>
namespace Web::HTML {
using HTMLOptionOrOptGroupElement = Variant<NonnullRefPtr<HTMLOptionElement>, NonnullRefPtr<HTMLOptGroupElement>>;
using HTMLElementOrElementIndex = Variant<NonnullRefPtr<HTMLElement>, i32>;
class HTMLOptionsCollection final : public DOM::HTMLCollection {
public:
using WrapperType = Bindings::HTMLOptionsCollectionWrapper;
@ -19,6 +24,8 @@ public:
return adopt_ref(*new HTMLOptionsCollection(root, move(filter)));
}
DOM::ExceptionOr<void> add(HTMLOptionOrOptGroupElement element, Optional<HTMLElementOrElementIndex> before = {});
protected:
HTMLOptionsCollection(DOM::ParentNode& root, Function<bool(DOM::Element const&)> filter);
};