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

LibWeb: Remove Element::set_attribute(name, value?)

That API came from a mistake in the IDL compiler, where reflected
nullable attributes would try to call set_attribute(name, null).
This commit fixes the mistake in the IDL generator, and removes the
meaningless API.
This commit is contained in:
Ali Mohammad Pur 2023-10-13 23:06:47 +03:30 committed by Tim Flynn
parent d2c7e1ea7d
commit 988c6568a9
4 changed files with 20 additions and 11 deletions

View file

@ -110,8 +110,8 @@ public:
DeprecatedString get_attribute_value(StringView local_name, DeprecatedFlyString const& namespace_ = {}) const;
WebIDL::ExceptionOr<void> set_attribute(DeprecatedFlyString const& name, DeprecatedString const& value);
WebIDL::ExceptionOr<void> set_attribute(DeprecatedFlyString const& name, Optional<String> const& value);
WebIDL::ExceptionOr<void> set_attribute(FlyString const& name, Optional<String> const& value)
WebIDL::ExceptionOr<void> set_attribute(DeprecatedFlyString const& name, String const& value);
WebIDL::ExceptionOr<void> set_attribute(FlyString const& name, String const& value)
{
return set_attribute(name.to_deprecated_fly_string(), value);
}
@ -265,7 +265,10 @@ public:
\
WebIDL::ExceptionOr<void> set_##name(Optional<String> const& value) override \
{ \
TRY(set_attribute(attribute, value)); \
if (value.has_value()) \
TRY(set_attribute(attribute, *value)); \
else \
remove_attribute(attribute); \
return {}; \
}