diff --git a/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp
index e7289b765cb..75bf9e8083c 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp
+++ b/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp
@@ -146,8 +146,18 @@ void HTMLElement::set_inner_text(StringView text)
set_needs_style_update(true);
}
-String HTMLElement::inner_text()
+// https://html.spec.whatwg.org/multipage/dom.html#the-innertext-idl-attribute:dom-outertext-2
+WebIDL::ExceptionOr HTMLElement::set_outer_text(String)
{
+ dbgln("FIXME: Implement HTMLElement::set_outer_text()");
+ return {};
+}
+
+// https://html.spec.whatwg.org/multipage/dom.html#get-the-text-steps
+String HTMLElement::get_the_text_steps()
+{
+ // FIXME: Implement this according to spec.
+
StringBuilder builder;
// innerText for element being rendered takes visibility into account, so force a layout and then walk the layout tree.
@@ -169,6 +179,20 @@ String HTMLElement::inner_text()
return MUST(builder.to_string());
}
+// https://html.spec.whatwg.org/multipage/dom.html#dom-innertext
+String HTMLElement::inner_text()
+{
+ // The innerText and outerText getter steps are to return the result of running get the text steps with this.
+ return get_the_text_steps();
+}
+
+// https://html.spec.whatwg.org/multipage/dom.html#dom-outertext
+String HTMLElement::outer_text()
+{
+ // The innerText and outerText getter steps are to return the result of running get the text steps with this.
+ return get_the_text_steps();
+}
+
// https://www.w3.org/TR/cssom-view-1/#dom-htmlelement-offsetparent
JS::GCPtr HTMLElement::offset_parent() const
{
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLElement.h b/Userland/Libraries/LibWeb/HTML/HTMLElement.h
index cfc800eb24e..e56c2020700 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLElement.h
+++ b/Userland/Libraries/LibWeb/HTML/HTMLElement.h
@@ -42,6 +42,9 @@ public:
String inner_text();
void set_inner_text(StringView);
+ [[nodiscard]] String outer_text();
+ WebIDL::ExceptionOr set_outer_text(String);
+
int offset_top() const;
int offset_left() const;
int offset_width() const;
@@ -87,6 +90,8 @@ private:
virtual JS::GCPtr global_event_handlers_to_event_target(FlyString const&) override { return *this; }
virtual void did_receive_focus() override;
+ [[nodiscard]] String get_the_text_steps();
+
JS::GCPtr m_dataset;
enum class ContentEditableState {
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLElement.idl
index 7fa441c14f5..73545f3cb59 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLElement.idl
+++ b/Userland/Libraries/LibWeb/HTML/HTMLElement.idl
@@ -26,7 +26,7 @@ interface HTMLElement : Element {
// FIXME: [CEReactions] attribute DOMString autocapitalize;
[LegacyNullToEmptyString, CEReactions] attribute DOMString innerText;
- // FIXME: [LegacyNullToEmptyString, CEReactions] attribute DOMString outerText;
+ [LegacyNullToEmptyString, CEReactions] attribute DOMString outerText;
// FIXME: ElementInternals attachInternals();