Serenity Operating System
1/*
2 * Copyright (c) 2021, Luke Wilde <lukew@serenityos.org>
3 *
4 * SPDX-License-Identifier: BSD-2-Clause
5 */
6
7#pragma once
8
9#include <LibJS/Heap/GCPtr.h>
10#include <LibWeb/Bindings/PlatformObject.h>
11#include <LibWeb/DOM/Document.h>
12#include <LibWeb/Forward.h>
13#include <LibWeb/WebIDL/ExceptionOr.h>
14
15namespace Web::HTML {
16
17// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#domparser
18class DOMParser final : public Bindings::PlatformObject {
19 WEB_PLATFORM_OBJECT(DOMParser, Bindings::PlatformObject);
20
21public:
22 static WebIDL::ExceptionOr<JS::NonnullGCPtr<DOMParser>> construct_impl(JS::Realm&);
23
24 virtual ~DOMParser() override;
25
26 JS::NonnullGCPtr<DOM::Document> parse_from_string(DeprecatedString const&, Bindings::DOMParserSupportedType type);
27
28private:
29 explicit DOMParser(JS::Realm&);
30
31 virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
32};
33
34}