1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 07:27:45 +00:00

LibWeb: Return InvalidCharacterError from Element::set_attribute() for empty attr

This is the first user of the new DOMException, using ExceptionOr. :^)
This commit is contained in:
Linus Groh 2021-02-19 19:13:08 +01:00 committed by Andreas Kling
parent 3da2b51d74
commit e064194061
2 changed files with 10 additions and 2 deletions

View file

@ -29,6 +29,7 @@
#include <AK/FlyString.h>
#include <AK/String.h>
#include <LibWeb/DOM/Attribute.h>
#include <LibWeb/DOM/ExceptionOr.h>
#include <LibWeb/DOM/NonDocumentTypeChildNode.h>
#include <LibWeb/DOM/ParentNode.h>
#include <LibWeb/HTML/AttributeNames.h>
@ -63,7 +64,7 @@ public:
bool has_attributes() const { return !m_attributes.is_empty(); }
String attribute(const FlyString& name) const;
String get_attribute(const FlyString& name) const { return attribute(name); }
void set_attribute(const FlyString& name, const String& value);
ExceptionOr<void> set_attribute(const FlyString& name, const String& value);
void remove_attribute(const FlyString& name);
template<typename Callback>