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

LibWeb: Implement Node.cloneNode for Attr nodes

This commit is contained in:
Andreas Kling 2022-12-13 13:08:46 +01:00
parent 9a9c8460aa
commit a004d3043f
3 changed files with 12 additions and 6 deletions

View file

@ -15,12 +15,17 @@ namespace Web::DOM {
JS::NonnullGCPtr<Attr> Attr::create(Document& document, FlyString local_name, DeprecatedString value, Element const* owner_element)
{
return *document.heap().allocate<Attr>(document.realm(), document, move(local_name), move(value), owner_element);
return *document.heap().allocate<Attr>(document.realm(), document, QualifiedName(move(local_name), {}, {}), move(value), owner_element);
}
Attr::Attr(Document& document, FlyString local_name, DeprecatedString value, Element const* owner_element)
JS::NonnullGCPtr<Attr> Attr::clone(Document& document)
{
return *heap().allocate<Attr>(realm(), document, m_qualified_name, m_value, nullptr);
}
Attr::Attr(Document& document, QualifiedName qualified_name, DeprecatedString value, Element const* owner_element)
: Node(document, NodeType::ATTRIBUTE_NODE)
, m_qualified_name(move(local_name), {}, {})
, m_qualified_name(move(qualified_name))
, m_value(move(value))
, m_owner_element(owner_element)
{