| 
									
										
										
										
											2021-09-26 15:24:41 +01:00
										 |  |  | /*
 | 
					
						
							| 
									
										
										
										
											2023-02-28 00:05:39 +00:00
										 |  |  |  * Copyright (c) 2021-2023, Luke Wilde <lukew@serenityos.org> | 
					
						
							| 
									
										
										
										
											2022-08-08 14:49:54 +02:00
										 |  |  |  * Copyright (c) 2022, Andreas Kling <kling@serenityos.org> | 
					
						
							| 
									
										
										
										
											2021-09-26 15:24:41 +01:00
										 |  |  |  * | 
					
						
							|  |  |  |  * SPDX-License-Identifier: BSD-2-Clause | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #pragma once
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-10-08 12:58:56 +02:00
										 |  |  | #include <LibWeb/Bindings/LegacyPlatformObject.h>
 | 
					
						
							| 
									
										
										
										
											2021-09-26 15:24:41 +01:00
										 |  |  | #include <LibWeb/Forward.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace Web::HTML { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // https://html.spec.whatwg.org/multipage/dom.html#domstringmap
 | 
					
						
							| 
									
										
										
										
											2022-10-08 12:58:56 +02:00
										 |  |  | class DOMStringMap final : public Bindings::LegacyPlatformObject { | 
					
						
							|  |  |  |     WEB_PLATFORM_OBJECT(DOMStringMap, Bindings::LegacyPlatformObject); | 
					
						
							| 
									
										
										
										
											2021-09-26 15:24:41 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-08-08 14:49:54 +02:00
										 |  |  | public: | 
					
						
							| 
									
										
										
										
											2023-02-15 19:18:58 +01:00
										 |  |  |     static WebIDL::ExceptionOr<JS::NonnullGCPtr<DOMStringMap>> create(DOM::Element&); | 
					
						
							| 
									
										
										
										
											2021-09-26 15:24:41 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     virtual ~DOMStringMap() override; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-12-04 18:02:33 +00:00
										 |  |  |     DeprecatedString determine_value_of_named_property(DeprecatedString const&) const; | 
					
						
							| 
									
										
										
										
											2021-09-26 15:24:41 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-02-28 00:05:39 +00:00
										 |  |  |     virtual WebIDL::ExceptionOr<void> set_value_of_new_named_property(DeprecatedString const&, JS::Value) override; | 
					
						
							|  |  |  |     virtual WebIDL::ExceptionOr<void> set_value_of_existing_named_property(DeprecatedString const&, JS::Value) override; | 
					
						
							| 
									
										
										
										
											2021-09-26 15:24:41 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-02-28 00:05:39 +00:00
										 |  |  |     virtual WebIDL::ExceptionOr<DidDeletionFail> delete_value(DeprecatedString const&) override; | 
					
						
							| 
									
										
										
										
											2021-09-26 15:24:41 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							| 
									
										
										
										
											2022-08-28 13:42:07 +02:00
										 |  |  |     explicit DOMStringMap(DOM::Element&); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-01-28 12:33:35 -05:00
										 |  |  |     virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; | 
					
						
							| 
									
										
										
										
											2022-08-28 13:42:07 +02:00
										 |  |  |     virtual void visit_edges(Cell::Visitor&) override; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-10-08 12:58:56 +02:00
										 |  |  |     // ^LegacyPlatformObject
 | 
					
						
							| 
									
										
										
										
											2023-02-28 00:05:39 +00:00
										 |  |  |     virtual WebIDL::ExceptionOr<JS::Value> named_item_value(DeprecatedFlyString const&) const override; | 
					
						
							| 
									
										
										
										
											2022-12-04 18:02:33 +00:00
										 |  |  |     virtual Vector<DeprecatedString> supported_property_names() const override; | 
					
						
							| 
									
										
										
										
											2022-10-08 12:58:56 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-02-28 00:05:39 +00:00
										 |  |  |     virtual bool supports_indexed_properties() const override { return false; } | 
					
						
							|  |  |  |     virtual bool supports_named_properties() const override { return true; } | 
					
						
							|  |  |  |     virtual bool has_indexed_property_setter() const override { return false; } | 
					
						
							|  |  |  |     virtual bool has_named_property_setter() const override { return true; } | 
					
						
							|  |  |  |     virtual bool has_named_property_deleter() const override { return true; } | 
					
						
							|  |  |  |     virtual bool has_legacy_override_built_ins_interface_extended_attribute() const override { return true; } | 
					
						
							|  |  |  |     virtual bool has_legacy_unenumerable_named_properties_interface_extended_attribute() const override { return false; } | 
					
						
							|  |  |  |     virtual bool has_global_interface_extended_attribute() const override { return false; } | 
					
						
							|  |  |  |     virtual bool indexed_property_setter_has_identifier() const override { return false; } | 
					
						
							|  |  |  |     virtual bool named_property_setter_has_identifier() const override { return false; } | 
					
						
							|  |  |  |     virtual bool named_property_deleter_has_identifier() const override { return false; } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-26 15:24:41 +01:00
										 |  |  |     struct NameValuePair { | 
					
						
							| 
									
										
										
										
											2022-12-04 18:02:33 +00:00
										 |  |  |         DeprecatedString name; | 
					
						
							|  |  |  |         DeprecatedString value; | 
					
						
							| 
									
										
										
										
											2021-09-26 15:24:41 +01:00
										 |  |  |     }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     Vector<NameValuePair> get_name_value_pairs() const; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     // https://html.spec.whatwg.org/multipage/dom.html#concept-domstringmap-element
 | 
					
						
							| 
									
										
										
										
											2022-08-28 13:42:07 +02:00
										 |  |  |     JS::NonnullGCPtr<DOM::Element> m_associated_element; | 
					
						
							| 
									
										
										
										
											2021-09-26 15:24:41 +01:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } |