summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/DOM/Attribute.cpp
blob: 77b5ebb1e70b6d1d6b6b3506a027e19596396c4f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/*
 * Copyright (c) 2021, Tim Flynn <trflynn89@serenityos.org>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#include <LibWeb/DOM/Attribute.h>
#include <LibWeb/DOM/Document.h>
#include <LibWeb/DOM/Element.h>

namespace Web::DOM {

NonnullRefPtr<Attribute> Attribute::create(Document& document, FlyString local_name, String value, Element const* owner_element)
{
    return adopt_ref(*new Attribute(document, move(local_name), move(value), owner_element));
}

Attribute::Attribute(Document& document, FlyString local_name, String value, Element const* owner_element)
    : Node(document, NodeType::ATTRIBUTE_NODE)
    , m_qualified_name(move(local_name), {}, {})
    , m_value(move(value))
    , m_owner_element(owner_element)
{
}

Element const* Attribute::owner_element() const
{
    return m_owner_element;
}

void Attribute::set_owner_element(Element const* owner_element)
{
    m_owner_element = owner_element;
}

}