Attribute.cpp 923 B

123456789101112131415161718192021222324252627282930313233343536
  1. /*
  2. * Copyright (c) 2021, Tim Flynn <trflynn89@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #include <LibWeb/DOM/Attribute.h>
  7. #include <LibWeb/DOM/Document.h>
  8. #include <LibWeb/DOM/Element.h>
  9. namespace Web::DOM {
  10. NonnullRefPtr<Attribute> Attribute::create(Document& document, FlyString local_name, String value, Element const* owner_element)
  11. {
  12. return adopt_ref(*new Attribute(document, move(local_name), move(value), owner_element));
  13. }
  14. Attribute::Attribute(Document& document, FlyString local_name, String value, Element const* owner_element)
  15. : Node(document, NodeType::ATTRIBUTE_NODE)
  16. , m_qualified_name(move(local_name), {}, {})
  17. , m_value(move(value))
  18. , m_owner_element(owner_element)
  19. {
  20. }
  21. Element const* Attribute::owner_element() const
  22. {
  23. return m_owner_element;
  24. }
  25. void Attribute::set_owner_element(Element const* owner_element)
  26. {
  27. m_owner_element = owner_element;
  28. }
  29. }