contenteditable Inheritance Behavior

Resolves contenteditable attribute state and whether ordinary element contents are editable using a caller-supplied inherited editable flag. Empty means true and invalid/omitted values inherit. DesignMode, rich-formatting inheritance and unrelated inertness are separate.

Description

Content editing can be explicitly enabled, disabled or limited to plain text.

Content editing can be explicitly enabled, disabled or limited to plain text. Missing and invalid attribute states inherit an editable flag from the surrounding context.1

The tool returns attributeState, editable. The fields describe the supplied local pattern or effective state, or contain the formatted markup shown below.

When to use contenteditable Inheritance Behavior

Use this for the following task: Resolves contenteditable attribute state and whether ordinary element contents are editable using a caller-supplied inherited editable flag. Empty means true and invalid/omitted values inherit. DesignMode, rich-formatting inheritance and unrelated inertness are separate. Provide the requested local fields extracted from the relevant element or attribute.

How to use contenteditable Inheritance Behavior and understand its results

  1. Prepare the parsed element names, attribute values or direct element-child lists requested below. Keep attribute presence separate from its value.
  2. Enter present, value, parentEditable according to the field table, then run the tool.
  3. Read attributeState, editable. Check the effective state, recognized-token flags or generated markup against the rules below.
  4. Correct any reported local mismatch and check the resulting markup in its intended document and browser context.
Input fieldMeaningValue type and boundsRequirement
presentPresentbooleanRequired
valueValuestring; maximum text length 100000Required
parentEditableParent EditablebooleanRequired

Supply presence, value and the inherited editable flag. Resolve the enumerated attribute state and use the parent only for inherit.

empty/true/plaintext-only → editable; false → not editable; absent/invalid → parentEditable

The symbols and boundary conditions refer to the supplied fields and the implementation described above.

Output fieldMeaningValue type
attributeStateAttribute Statestring
editableEditableboolean
json
{
  "input": {
    "present": true,
    "value": "plaintext-only",
    "parentEditable": false
  },
  "output": {
    "attributeState": "plaintext-only",
    "editable": true
  }
}

Limitations and assumptions

The present flag distinguishes an absent attribute from a present empty value. Keyword matching folds ASCII uppercase without trimming. This models ordinary element contents; designMode, rich-formatting inheritance and unrelated inertness are separate.

The tool does not fetch a page, run a browser or validate an entire HTML document. Malformed tool requests produce input errors; valid requests can still report unrecognized values or failed local checks.

Alternative or Complementary methods

Choose translate Attribute Inheritance when you need its operation: Resolves translate yes/no and inherited translation mode. Empty means yes, invalid and omitted values inherit; supply true as the parent mode for a root element without an ancestor. Choose spellcheck Tri-State Inherit Default for the complementary operation: Resolves spellcheck attribute and IDL flag using caller-supplied true, false or inherit default behavior and parent flag. Missing/invalid attributes use the default behavior, which need not inherit. This does not override user preferences or decide which text is checkable.

Background reference: HTML Standard: contenteditable Inheritance Behavior.

References

  1. HTML Standard: contenteditable Inheritance Behavior — WHATWG

Similar or alternative tools

  • translate Attribute Inheritance

    Resolves translate yes/no and inherited translation mode. Empty means yes, invalid and omitted values inherit; supply true as the parent mode for a root element without an ancestor.

  • spellcheck Tri-State Inherit Default

    Resolves spellcheck attribute and IDL flag using caller-supplied true, false or inherit default behavior and parent flag. Missing/invalid attributes use the default behavior, which need not inherit. This does not override user preferences or decide which text is checkable.

Don't forget to set a bookmark for tool.io!
Privacy | Imprint | Cookies