diff --git a/Tests/LibWeb/Text/expected/HTML/HTMLElement-isContentEditable.txt b/Tests/LibWeb/Text/expected/HTML/HTMLElement-isContentEditable.txt new file mode 100644 index 00000000000..1ba8c141cff --- /dev/null +++ b/Tests/LibWeb/Text/expected/HTML/HTMLElement-isContentEditable.txt @@ -0,0 +1 @@ + true diff --git a/Tests/LibWeb/Text/input/HTML/HTMLElement-isContentEditable.html b/Tests/LibWeb/Text/input/HTML/HTMLElement-isContentEditable.html new file mode 100644 index 00000000000..fcac25e82f7 --- /dev/null +++ b/Tests/LibWeb/Text/input/HTML/HTMLElement-isContentEditable.html @@ -0,0 +1,7 @@ + +
+ diff --git a/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp index 03cda6a6cd1..690ed956d51 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp @@ -98,6 +98,14 @@ bool HTMLElement::is_focusable() const return m_content_editable_state == ContentEditableState::True; } +// https://html.spec.whatwg.org/multipage/interaction.html#dom-iscontenteditable +bool HTMLElement::is_content_editable() const +{ + // The isContentEditable IDL attribute, on getting, must return true if the element is either an editing host or + // editable, and false otherwise. + return is_editable(); +} + StringView HTMLElement::content_editable() const { switch (m_content_editable_state) { diff --git a/Userland/Libraries/LibWeb/HTML/HTMLElement.h b/Userland/Libraries/LibWeb/HTML/HTMLElement.h index cc4a8946b04..dea86d592e5 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLElement.h @@ -35,6 +35,7 @@ public: virtual bool is_editable() const final; virtual bool is_focusable() const override; + bool is_content_editable() const; StringView content_editable() const; WebIDL::ExceptionOr