[whatwg] Proposal: Undeletable elements within contentEditable

Nikita Vasilyev me at elv1s.ru
Thu Jun 24 09:08:50 PDT 2010


The current version of spec http://www.whatwg.org/specs/web-apps/current-work/multipage/editing.html#contenteditable
does not define any way to make an element within contentEditable  
undeletable. I propose "undeletable" attribute:

element.undeletable = "true" | "false"

How should it work:

<div contenteditable>
   <span undeletable>foo</span>
</div>

When I focus on the div, select all the text, and delete it, the span  
element MUST be empty, but MUST NOT be deleted.

This behavior would be very useful while building code editors. I'm  
building CSS editor with syntax highlighting and auto-completion based  
on contentEditable. "undeletable" attribute would help me a lot.



More information about the whatwg mailing list