Re: Thoughts on implementing the HTML5 <details> element with pure CSS

On Wed, Apr 7, 2010 at 7:54 AM, Brad Kemper <brad.kemper@gmail.com> wrote:
>
> On Apr 7, 2010, at 4:07 AM, Daniel Glazman wrote:
>
>> Le 07/04/10 08:13, Maciej Stachowiak a écrit :
>>
>>
>>> 2) I need the <summary> child of <details> to remain visible both when
>>> expanded and collapsed, but have all the other contents appear or
>>> disappear, including direct text node children of the <details> element.
>>> However, there is no way to address all of the children of <details>
>>> except the <summary> child with a CSS selector.
>>
>> details > *:not(summary) ?
>>
>> That said, this will not address text nodes children of <details>. But
>> IMHO, allowing text nodes here is a design mistake. DLs have DTs and
>> DDs. <details> should only have element children.

Funny that you should mention <dl>, which we perennially complain
about lacking a <di> element for grouping.  ^_^

I tried to get a container element required, but didn't succeed.
Turns out, in my own experiments with using <details>, that it's
rather cumbersome to use one anyway.  Much easier to just treat the
<summary> as a type of heading for the content of <details>, which is
what HTML5 now requires.


> But this element is not defined that way. So if a closed <details> still showed some of its children (even text nodes), then it would be an implementation mistake too (if this was part of the UA style sheet).
>
> It would be better if there was an element surrounding just the part that was open. If HTML5 wasn't thoughtful enough to include one, maybe we could add it as a pseudo-element?
>
> details::actual-details { display:none }
> details[open]::actual-details { display:block; }

I agree.  I don't care what the actual name is, but am fine with
Anne's suggestion of ::value.

~TJ

Received on Wednesday, 7 April 2010 15:23:09 UTC