This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
On Wed, 5 Sep 2012, Ojan Vafai wrote: > On Wed, Aug 29, 2012 at 4:27 PM, Ian Hickson <ian@hixie.ch> wrote: > > On Sun, 17 Jun 2012, Aryeh Gregor wrote: > > > > > > If you type some stuff and then delete it all, the desired result > > > will vary based on lots of factors, e.g.: > > > > > > * Whether <div> or <p> is being used for paragraph separators. > > > Both <p><br></p> and <div><br></div> might make sense for "nothing", > > > depending. This is author-configurable using the > > > defaultParagraphSeparator command. > > > > > > * Whether there was any styling present before. If all the text was > > > previously bold, for instance, deleting everything might result in > > > something like <p><b><br></b></p>, because per spec, deletion > > > doesn't remove style tags from empty lines. > > > > > > * Whether there was any other special markup. If something (like > > > execCommand("insertHTML")) made the first line have <p id="foo">, > > > then deleting everything would result in <p id="foo"><br></p>. > > > > > > * What the author specified as the initial contents of the editable > > > area. If you have <div contenteditable><br></div> to start with, > > > and the user puts the cursor there and then types "foo" and then > > > deletes it, you'll go back to having just <br>, because nothing ever > > > inserted a <p> or <div> or anything. (As soon as the user hits > > > Enter, both the old and new lines are wrapped in a paragraph > > > separator per spec, although only IE/Opera do this right now.) > > > > > > Really, you can have any HTML markup at all in contenteditable, and > > > we can't avoid that. There's not going to be any reliable way to > > > figure out what "nothing" is if you can't answer the same question > > > for arbitrary HTML. > > > > Maybe the right way to detect "nothing" is to compare textContent > > against "" and then to look for specific elements that count as > > palpable content, like <img>. Would it make sense to provide an API > > for that? > > Seems reasonable to me. That's the trickiest part of making this work > from script. If you had an API for this, hooking focus/blur events is > pretty straightforward. If, in the end, we still decide to add > placeholder, it will just use this API anyways.
If this is still desired, please file a new issue at https://github.com/whatwg/html/issues/new.