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

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