summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/HTML/DOMParser.h
blob: 9746eb21c2574ec0dcd69ade8deb0c9210e53f84 (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
37
38
39
/*
 * Copyright (c) 2021, Luke Wilde <lukew@serenityos.org>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#pragma once

#include <AK/RefCounted.h>
#include <AK/Weakable.h>
#include <LibWeb/Bindings/Wrappable.h>
#include <LibWeb/DOM/Document.h>
#include <LibWeb/DOM/ExceptionOr.h>
#include <LibWeb/Forward.h>

namespace Web::HTML {

// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#domparser
class DOMParser final
    : public RefCounted<DOMParser>
    , public Weakable<DOMParser>
    , public Bindings::Wrappable {
public:
    using WrapperType = Bindings::DOMParserWrapper;

    static DOM::ExceptionOr<NonnullRefPtr<DOMParser>> create_with_global_object(Bindings::WindowObject&)
    {
        return adopt_ref(*new DOMParser());
    }

    virtual ~DOMParser() override;

    NonnullRefPtr<DOM::Document> parse_from_string(String const&, String const&);

private:
    DOMParser();
};

}