W3C home > Mailing lists > Public > www-style@w3.org > February 2010

Re: collapsible property

From: Andrew Fedoniouk <news@terrainformatica.com>
Date: Thu, 11 Feb 2010 21:27:43 -0800
Message-ID: <4B74E6CF.8070603@terrainformatica.com>
To: Daniel Danilatos <danilatos@google.com>
CC: Patrick Garies <pgaries@fastmail.us>, www-style@w3.org, Julie Parent <jparent@chromium.org>, fantasai <fantasai.lists@inkedblade.net>, Ojan Vafai <ojan@chromium.org>
Daniel Danilatos wrote:
> 2010/2/12 Andrew Fedoniouk <news@terrainformatica.com>:
>> Daniel Danilatos wrote:
>>> 2010/2/11 Andrew Fedoniouk <news@terrainformatica.com>:
>>>> Daniel Danilatos wrote:
>>>>> Inferring orthogonal behaviour from line height or similar properties
>>>>> seems kinda hacky and potentially leading to all kinds of corner cases.
>>>>> I
>>>>> think it's clearer and simpler to have a property that defines exactly
>>>>> the
>>>>> desired behaviour (keep the block element open) and leave things like
>>>>> line
>>>>> height and min height to their independent meanings, without having to
>>>>> complicate them with extended interpretations
>>>> Could you define the meaning of "the block element open"?
>>> non-collapsed and able to accommodate a cursor
>> If you think that "non-collapsed" makes things clear then no.
>>
>> For example how you would classify this:
>>
>> <p><span style="display:inline-block; height:1px"></span></p>
>>
>> ? As collapsed or no?
>>
> 
> Perhaps I shouldn't say "non-collapsed" because my meaning can be
> misinterpreted. I gave a clearer definition when I mentioned the <br>
> in answer to your second question from the earlier email, hopefully
> that answers the above question too.

<br> where?

Here:

<p>|<span></span></p>

or here:

<p><span>|</span></p>

?

If these P and SPAN have different font-size properties then you will
get different heights in these cases thus your "collapsing" term is very 
fuzzy.

> 
>>>> When element is "open" what height/width it should have?
>>> The same as when the current "tricks" to keep it open are applied,
>>> e.g. on webkit and firefox placing a <br> inside it, on IE a "magic"
>>> &nbsp; (that is not in the DOM but appears in the innerHTML...)
>> I think that p { min-height:1em; } is a least controversial solution that
>> you can get. And it works already.
> 
> I've tried it, it doesn't work. The height differs by a few pixels
> when it is empty vs not empty, and the difference is affected by line
> height and other properties. It might be the case that with sufficient
> CSS hackery there will be a brittle solution, but I think that's far
> less desirable than a property that has the exact semantic meaning of
> what is desired.

Few pixels kind of error but now and some collapsing property in next 10 
years. Choice is yours.

> 
> It also doesn't work at all in IE.

It is a bit optimistic to expect it to support 'collapsing' either.

> 
>> And my condolences if you are in business of designing WYSIWYG editing with
>> CSS.
>>
> 
> What do you mean by "designing WYSIWYG editing with CSS"? Keeping a
> block element "open" is a well known problem faced by many rich text
> editor implementations, and currently they are forced to resort to
> various tricks and hacks to do the job. The fact that the native
> contentEditable behaviour of webkit, gecko and IE all differ in how
> they solve this (webkit installs a BR when the block element is empty,
> gecko always has a BR, and IE puts a magic &nbsp;) indicates that this
> is a problem that needs a standard solution. They are also buggy, in
> that they don't always correctly employ their respective trick,
> resulting in collapsed unusable block elements (and it is even harder
> for a javascript application trying to control this to figure out when
> it should employ the trick). Incidentally, no browser uses min-height
> as its native method of keeping block elements open.

When you will create WYSIWYG editor that will be able to visualize
all three text insertion points (caret positions) here:

<p><span></span></p>

then probably CSS will help you in your task.

Otherwise insertion of some character placeholder (like <br> or some 
other space character) is the best what you can get.


> 
>>>>>> On 10 Feb 2010 21:30, "Patrick Garies" <pgaries@fastmail.us
>>>>>> <mailto:pgaries@fastmail.us>> wrote:
>>>>>>
>>>>>> On 2010-02-10 7:59 PM, Ojan Vafai wrote:
>>>>>>> Does this work? You want the height to be the line-heig...
>>>>>> I don't know of any way to get the line-height, but you can estimate
>>>>>> (e.g., |1.2em|) or explicitly specify it then match the height to it.
>>>>>>
>>>>>>
>>>>>>
>>>>>>> Also, what if you want some divs to be <1em?
>>>>>> Use a |class| attribute?
>>>> --


-- 
Andrew Fedoniouk.

http://terrainformatica.com
Received on Friday, 12 February 2010 05:28:04 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:24 GMT