1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 17:17:44 +00:00

LibWeb: Implement Element.setAttributeNode{,NS}()

This commit is contained in:
Andreas Kling 2023-03-10 14:56:29 +01:00
parent 8c5c78f1f1
commit fb6d6a985f
7 changed files with 33 additions and 8 deletions

View file

@ -95,13 +95,13 @@ Attr const* NamedNodeMap::get_named_item_ns(StringView namespace_, StringView lo
}
// https://dom.spec.whatwg.org/#dom-namednodemap-setnameditem
WebIDL::ExceptionOr<Attr const*> NamedNodeMap::set_named_item(Attr& attribute)
WebIDL::ExceptionOr<JS::GCPtr<Attr>> NamedNodeMap::set_named_item(Attr& attribute)
{
return set_attribute(attribute);
}
// https://dom.spec.whatwg.org/#dom-namednodemap-setnameditemns
WebIDL::ExceptionOr<Attr const*> NamedNodeMap::set_named_item_ns(Attr& attribute)
WebIDL::ExceptionOr<JS::GCPtr<Attr>> NamedNodeMap::set_named_item_ns(Attr& attribute)
{
return set_attribute(attribute);
}
@ -195,7 +195,7 @@ Attr const* NamedNodeMap::get_attribute_ns(StringView namespace_, StringView loc
}
// https://dom.spec.whatwg.org/#concept-element-attributes-set
WebIDL::ExceptionOr<Attr const*> NamedNodeMap::set_attribute(Attr& attribute)
WebIDL::ExceptionOr<JS::GCPtr<Attr>> NamedNodeMap::set_attribute(Attr& attribute)
{
// 1. If attrs element is neither null nor element, throw an "InUseAttributeError" DOMException.
if ((attribute.owner_element() != nullptr) && (attribute.owner_element() != &associated_element()))