LibWeb: Add a DOM::Element::set_attribute override for UTF-16 strings

This just transcodes to UTF-8 for now, but primarily serves to to keep
compatibility with generated IDL definitions.
This commit is contained in:
Timothy Flynn 2025-07-26 11:00:09 -04:00 committed by Andreas Kling
commit e7b08cf291
Notes: github-actions[bot] 2025-07-28 10:26:37 +00:00
6 changed files with 14 additions and 7 deletions

View file

@ -229,6 +229,12 @@ WebIDL::ExceptionOr<void> Element::set_attribute(FlyString const& name, String c
return {};
}
// https://dom.spec.whatwg.org/#dom-element-setattribute
WebIDL::ExceptionOr<void> Element::set_attribute(FlyString const& name, Utf16String const& value)
{
return set_attribute(name, value.to_utf8_but_should_be_ported_to_utf16());
}
// https://dom.spec.whatwg.org/#valid-namespace-prefix
bool is_valid_namespace_prefix(FlyString const& prefix)
{