mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-27 21:21:50 +03:00
LibWeb: Add HTMLElement::is_content_editable()
This commit is contained in:
parent
934aa6af6a
commit
e3c75d7b6f
Notes:
sideshowbarker
2024-07-16 23:54:15 +09:00
Author: https://github.com/kalenikaliaksandr Commit: https://github.com/SerenityOS/serenity/commit/e3c75d7b6f Pull-request: https://github.com/SerenityOS/serenity/pull/23338
@ -0,0 +1 @@
|
||||
true
|
@ -0,0 +1,7 @@
|
||||
<script src="../include.js"></script>
|
||||
<div contenteditable="true" id="contenteditable"></div>
|
||||
<script>
|
||||
test(() => {
|
||||
println(document.getElementById("contenteditable").isContentEditable);
|
||||
});
|
||||
</script>
|
@ -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) {
|
||||
|
@ -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<void> set_content_editable(StringView);
|
||||
|
||||
|
@ -53,7 +53,7 @@ HTMLElement includes HTMLOrSVGElement;
|
||||
interface mixin ElementContentEditable {
|
||||
[CEReactions] attribute DOMString contentEditable;
|
||||
// FIXME: [CEReactions] attribute DOMString enterKeyHint;
|
||||
// FIXME: readonly attribute boolean isContentEditable;
|
||||
readonly attribute boolean isContentEditable;
|
||||
// FIXME: [CEReactions] attribute DOMString inputMode;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user