summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/DOM/Text.cpp
blob: 27d8783984e789f20f5402381a5ce31e325a280c (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
/*
 * Copyright (c) 2018-2022, Andreas Kling <kling@serenityos.org>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#include <LibWeb/DOM/Text.h>
#include <LibWeb/HTML/HTMLInputElement.h>
#include <LibWeb/HTML/Window.h>
#include <LibWeb/Layout/TextNode.h>

namespace Web::DOM {

Text::Text(Document& document, const String& data)
    : CharacterData(document, NodeType::TEXT_NODE, data)
{
}

// https://dom.spec.whatwg.org/#dom-text-text
NonnullRefPtr<Text> Text::create_with_global_object(Bindings::WindowObject& window, String const& data)
{
    return make_ref_counted<Text>(window.impl().associated_document(), data);
}

void Text::set_owner_input_element(Badge<HTML::HTMLInputElement>, HTML::HTMLInputElement& input_element)
{
    m_owner_input_element = input_element;
}

}