W3C home > Mailing lists > Public > whatwg@whatwg.org > October 2012

Re: [whatwg] Should editable elements have placeholder attribute?

From: Ian Hickson <ian@hixie.ch>
Date: Wed, 17 Oct 2012 23:37:33 +0000 (UTC)
To: Aryeh Gregor <ayg@aryeh.name>, "Tab Atkins Jr." <jackalmage@gmail.com>, Ojan Vafai <ojan@chromium.org>, Simon Pieters <simonp@opera.com>
Message-ID: <Pine.LNX.4.64.1210172334490.2478@ps20323.dreamhostps.com>
Cc: whatwg <whatwg@lists.whatwg.org>, James Graham <jgraham@opera.com>
On Thu, 6 Sep 2012, Aryeh Gregor wrote:
> It should never be possible to make a contenteditable element contain 
> nothing, once it has something in it, because then it would collapse to 
> zero height and you wouldn't be able to click on it. [...]

On Thu, 6 Sep 2012, Ojan Vafai wrote:
> While WebKit does put the magic <br> in, that's not what avoids the 
> collapsing in this case. If you set the innerHTML to "", it still 
> doesn't collapse. We actually hard-code that editing hosts don't 
> collapse.

How should we spec this?

On Thu, 13 Sep 2012, Ojan Vafai wrote:
> The way I'd want to see this happen is to expose a CSS property that
> prevents collapsing empty elements, then we'd add something like the
> following to the UA stylesheet:
> *[contentEditable=true] { empty-collapse-behavior: no-collapse }

On Fri, 14 Sep 2012, Simon Pieters wrote:
> That sounds like a good solution on first blush and might even be 
> something authors would like to use for other elements. However, the 
> selector is wrong since contenteditable is an enumerated attribute which 
> allow mixed case, and further the empty string is a valid keyword 
> (meaning true). I think this would be correct:
> *[contenteditable=true i], *[contenteditable=""] { empty-collapse: no-collapse }

I'm happy to add that to the default style sheet if CSS had such a 
property; anyone want to spec it?

Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Wednesday, 17 October 2012 23:37:59 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:46 UTC