1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 18:27:35 +00:00

LibWeb: Port Comment interface from DeprecatedString to String

This commit is contained in:
Shannon Booth 2023-09-05 00:01:53 +12:00 committed by Tim Flynn
parent 4da1f4e836
commit cc1e4c5cb3
6 changed files with 14 additions and 14 deletions

View file

@ -11,13 +11,13 @@
namespace Web::DOM {
Comment::Comment(Document& document, DeprecatedString const& data)
: CharacterData(document, NodeType::COMMENT_NODE, data)
Comment::Comment(Document& document, String const& data)
: CharacterData(document, NodeType::COMMENT_NODE, data.to_deprecated_string())
{
}
// https://dom.spec.whatwg.org/#dom-comment-comment
WebIDL::ExceptionOr<JS::NonnullGCPtr<Comment>> Comment::construct_impl(JS::Realm& realm, DeprecatedString const& data)
WebIDL::ExceptionOr<JS::NonnullGCPtr<Comment>> Comment::construct_impl(JS::Realm& realm, String const& data)
{
auto& window = verify_cast<HTML::Window>(realm.global_object());
return realm.heap().allocate<Comment>(realm, window.associated_document(), data);

View file

@ -15,13 +15,13 @@ class Comment final : public CharacterData {
WEB_PLATFORM_OBJECT(Comment, CharacterData);
public:
static WebIDL::ExceptionOr<JS::NonnullGCPtr<Comment>> construct_impl(JS::Realm&, DeprecatedString const& data);
static WebIDL::ExceptionOr<JS::NonnullGCPtr<Comment>> construct_impl(JS::Realm&, String const& data);
virtual ~Comment() override = default;
virtual DeprecatedFlyString node_name() const override { return "#comment"; }
private:
Comment(Document&, DeprecatedString const&);
Comment(Document&, String const&);
virtual void initialize(JS::Realm&) override;
};

View file

@ -1,7 +1,7 @@
#import <DOM/CharacterData.idl>
// https://dom.spec.whatwg.org/#comment
[Exposed=Window, UseDeprecatedAKString]
[Exposed=Window]
interface Comment : CharacterData {
constructor(optional DOMString data = "");
};

View file

@ -1427,7 +1427,7 @@ JS::NonnullGCPtr<Text> Document::create_text_node(DeprecatedString const& data)
JS::NonnullGCPtr<Comment> Document::create_comment(DeprecatedString const& data)
{
return heap().allocate<Comment>(realm(), *this, data);
return heap().allocate<Comment>(realm(), *this, MUST(String::from_deprecated_string(data)));
}
// https://dom.spec.whatwg.org/#dom-document-createprocessinginstruction

View file

@ -812,7 +812,7 @@ JS::NonnullGCPtr<Node> Node::clone_node(Document* document, bool clone_children)
auto comment = verify_cast<Comment>(this);
// Set copys data to that of node.
auto comment_copy = heap().allocate<Comment>(realm(), *document, comment->data());
auto comment_copy = heap().allocate<Comment>(realm(), *document, MUST(String::from_deprecated_string(comment->data())));
copy = move(comment_copy);
} else if (is<ProcessingInstruction>(this)) {
// ProcessingInstruction