mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-05 06:32:30 +02:00
LibWeb: Add CharacterData and Text IDL interfaces
This commit is contained in:
Notes:
sideshowbarker
2024-07-19 04:20:43 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/73645e11c4b
@@ -36,11 +36,15 @@ class CharacterData
|
||||
: public Node
|
||||
, public NonDocumentTypeChildNode<CharacterData> {
|
||||
public:
|
||||
using WrapperType = Bindings::CharacterDataWrapper;
|
||||
|
||||
virtual ~CharacterData() override;
|
||||
|
||||
const String& data() const { return m_data; }
|
||||
void set_data(const String& data) { m_data = data; }
|
||||
|
||||
unsigned length() const { return m_data.length(); }
|
||||
|
||||
virtual String text_content() const override { return m_data; }
|
||||
|
||||
protected:
|
||||
|
||||
9
Libraries/LibWeb/DOM/CharacterData.idl
Normal file
9
Libraries/LibWeb/DOM/CharacterData.idl
Normal file
@@ -0,0 +1,9 @@
|
||||
interface CharacterData : Node {
|
||||
|
||||
attribute DOMString data;
|
||||
readonly attribute unsigned long length;
|
||||
|
||||
readonly attribute Element? nextElementSibling;
|
||||
readonly attribute Element? previousElementSibling;
|
||||
|
||||
}
|
||||
@@ -34,6 +34,8 @@ namespace Web::DOM {
|
||||
|
||||
class Text final : public CharacterData {
|
||||
public:
|
||||
using WrapperType = Bindings::TextWrapper;
|
||||
|
||||
explicit Text(Document&, const String&);
|
||||
virtual ~Text() override;
|
||||
|
||||
|
||||
3
Libraries/LibWeb/DOM/Text.idl
Normal file
3
Libraries/LibWeb/DOM/Text.idl
Normal file
@@ -0,0 +1,3 @@
|
||||
interface Text : CharacterData {
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user