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

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.

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; }

Received on Wednesday, 7 April 2010 14:54:42 UTC