CKTIS / HTML
HTML term or value: contenteditable
The `contenteditable` attribute enables or disables editing of an element’s contents, but it does not create a form control or provide safe persistence by itself.
Version: WHATWG HTML Living Standard; index snapshot date recorded separately
Syntax
<section contenteditable="true">…</section>contenteditable is enumerated, not boolean: the empty value and true enable editing, false disables it, and plaintext-only limits operations to plain text. A missing or invalid value inherits the state from an ancestor.
The contentEditable property reports the declaration and returns inherit for a missing or invalid value; isContentEditable reports the computed state in context. A descendant can therefore be editable despite its own invalid token.
A nested editing host is normally absent from the separate keyboard tab order; add tabindex="0" if it must be an independent target. Edits mutate the DOM, are not automatically submitted with a form, and stored HTML needs sanitization; plain-text mode also changes paste handling.
The example places contenteditable="invalid" below an editable parent: contentEditable returns inherit, while isContentEditable returns true. This exposes the boundary between the declaration and the inherited state.
Examples
<!doctype html><meta charset="utf-8"><div id="p" contenteditable="true"><span id="x" contenteditable="invalid">Text</span></div><output id="result"></output><script>result.textContent=`parent=${p.isContentEditable}; child=${x.isContentEditable}; raw=${x.contentEditable}`;</script>Result
parent=true; child=true; raw=inherit
The executed example verifies inherited editability for a descendant with an invalid token and distinguishes the two IDL views.