mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 18:17:45 +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:
parent
d2c7e1ea7d
commit
988c6568a9
4 changed files with 20 additions and 11 deletions
|
@ -206,12 +206,9 @@ WebIDL::ExceptionOr<void> Element::set_attribute(DeprecatedFlyString const& name
|
|||
return {};
|
||||
}
|
||||
|
||||
WebIDL::ExceptionOr<void> Element::set_attribute(DeprecatedFlyString const& name, Optional<String> const& value)
|
||||
WebIDL::ExceptionOr<void> Element::set_attribute(DeprecatedFlyString const& name, String const& value)
|
||||
{
|
||||
if (!value.has_value())
|
||||
return set_attribute(name, DeprecatedString {});
|
||||
|
||||
return set_attribute(name, value->to_deprecated_string());
|
||||
return set_attribute(name, value.to_deprecated_string());
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#validate-and-extract
|
||||
|
|
|
@ -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 {}; \
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue