-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The main thing that is missing is validating certain pieces of data against XML productions in well-formed mode, but nothing uses well-formed mode right now. Required by Closure Library for sanitising HTML. https://github.com/google/closure-library/blob/e687b3d8ab014787b9f10b08b3f597b637392480/closure/goog/html/sanitizer/safedomtreeprocessor.js#L117
- Loading branch information
Showing
10 changed files
with
943 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* Copyright (c) 2022, Luke Wilde <[email protected]> | ||
* | ||
* SPDX-License-Identifier: BSD-2-Clause | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <AK/RefCounted.h> | ||
#include <LibWeb/Bindings/Wrappable.h> | ||
#include <LibWeb/Forward.h> | ||
|
||
namespace Web::DOMParsing { | ||
|
||
class XMLSerializer final | ||
: public RefCounted<XMLSerializer> | ||
, public Bindings::Wrappable { | ||
public: | ||
using WrapperType = Bindings::XMLSerializerWrapper; | ||
|
||
static NonnullRefPtr<XMLSerializer> create_with_global_object(Bindings::WindowObject&) | ||
{ | ||
return adopt_ref(*new XMLSerializer()); | ||
} | ||
|
||
virtual ~XMLSerializer() override; | ||
|
||
DOM::ExceptionOr<String> serialize_to_string(NonnullRefPtr<DOM::Node> root); | ||
|
||
private: | ||
XMLSerializer(); | ||
}; | ||
|
||
enum class RequireWellFormed { | ||
No, | ||
Yes, | ||
}; | ||
|
||
DOM::ExceptionOr<String> serialize_node_to_xml_string(NonnullRefPtr<DOM::Node> root, RequireWellFormed require_well_formed); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#import <DOM/Node.idl> | ||
|
||
[Exposed=Window] | ||
interface XMLSerializer { | ||
constructor(); | ||
DOMString serializeToString(Node root); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters