2021-09-26 11:24:41 -03:00
|
|
|
/*
|
2023-02-27 21:05:39 -03:00
|
|
|
* Copyright (c) 2021-2023, Luke Wilde <lukew@serenityos.org>
|
2024-10-04 08:19:50 -03:00
|
|
|
* Copyright (c) 2022, Andreas Kling <andreas@ladybird.org>
|
2021-09-26 11:24:41 -03:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2024-01-09 20:05:03 -03:00
|
|
|
#include <LibWeb/Bindings/PlatformObject.h>
|
2021-09-26 11:24:41 -03:00
|
|
|
#include <LibWeb/Forward.h>
|
|
|
|
|
|
|
|
|
|
namespace Web::HTML {
|
|
|
|
|
|
|
|
|
|
// https://html.spec.whatwg.org/multipage/dom.html#domstringmap
|
2024-01-09 20:05:03 -03:00
|
|
|
class DOMStringMap final : public Bindings::PlatformObject {
|
|
|
|
|
WEB_PLATFORM_OBJECT(DOMStringMap, Bindings::PlatformObject);
|
2023-11-19 15:47:52 -03:00
|
|
|
JS_DECLARE_ALLOCATOR(DOMStringMap);
|
2021-09-26 11:24:41 -03:00
|
|
|
|
2022-08-08 09:49:54 -03:00
|
|
|
public:
|
2023-08-13 08:05:26 -03:00
|
|
|
[[nodiscard]] static JS::NonnullGCPtr<DOMStringMap> create(DOM::Element&);
|
2021-09-26 11:24:41 -03:00
|
|
|
|
|
|
|
|
virtual ~DOMStringMap() override;
|
|
|
|
|
|
2023-11-21 17:03:44 -03:00
|
|
|
String determine_value_of_named_property(FlyString const&) const;
|
2021-09-26 11:24:41 -03:00
|
|
|
|
2023-11-20 20:15:56 -03:00
|
|
|
virtual WebIDL::ExceptionOr<void> set_value_of_new_named_property(String const&, JS::Value) override;
|
|
|
|
|
virtual WebIDL::ExceptionOr<void> set_value_of_existing_named_property(String const&, JS::Value) override;
|
2021-09-26 11:24:41 -03:00
|
|
|
|
2023-11-20 20:15:56 -03:00
|
|
|
virtual WebIDL::ExceptionOr<DidDeletionFail> delete_value(String const&) override;
|
2021-09-26 11:24:41 -03:00
|
|
|
|
|
|
|
|
private:
|
2022-08-28 08:42:07 -03:00
|
|
|
explicit DOMStringMap(DOM::Element&);
|
|
|
|
|
|
2023-08-07 03:41:28 -03:00
|
|
|
virtual void initialize(JS::Realm&) override;
|
2022-08-28 08:42:07 -03:00
|
|
|
virtual void visit_edges(Cell::Visitor&) override;
|
|
|
|
|
|
2024-01-09 20:05:03 -03:00
|
|
|
// ^PlatformObject
|
2024-07-25 02:36:10 -03:00
|
|
|
virtual JS::Value named_item_value(FlyString const&) const override;
|
2023-12-24 16:59:00 -03:00
|
|
|
virtual Vector<FlyString> supported_property_names() const override;
|
2022-10-08 07:58:56 -03:00
|
|
|
|
2021-09-26 11:24:41 -03:00
|
|
|
struct NameValuePair {
|
2023-11-21 17:03:44 -03:00
|
|
|
FlyString name;
|
|
|
|
|
String value;
|
2021-09-26 11:24:41 -03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Vector<NameValuePair> get_name_value_pairs() const;
|
|
|
|
|
|
|
|
|
|
// https://html.spec.whatwg.org/multipage/dom.html#concept-domstringmap-element
|
2022-08-28 08:42:07 -03:00
|
|
|
JS::NonnullGCPtr<DOM::Element> m_associated_element;
|
2021-09-26 11:24:41 -03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|