Text.cpp 603 B

12345678910111213141516171819202122232425262728
  1. /*
  2. * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #include <LibWeb/DOM/Text.h>
  7. #include <LibWeb/DOM/Window.h>
  8. #include <LibWeb/Layout/TextNode.h>
  9. namespace Web::DOM {
  10. Text::Text(Document& document, const String& data)
  11. : CharacterData(document, NodeType::TEXT_NODE, data)
  12. {
  13. }
  14. Text::~Text()
  15. {
  16. }
  17. // https://dom.spec.whatwg.org/#dom-text-text
  18. NonnullRefPtr<Text> Text::create_with_global_object(Bindings::WindowObject& window, String const& data)
  19. {
  20. return make_ref_counted<Text>(window.impl().associated_document(), data);
  21. }
  22. }