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

On Wed, 07 Apr 2010 16:54:06 +0200, 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.
>
> 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; }

FWIW, HTML5 defines <details> in terms of a simple XBL binding. See:

   http://www.whatwg.org/html#the-details-element-0

Having a pseudo-element for the second box would make sense to me (iirc I  
suggested re-using ::value in some other thread).


-- 
Anne van Kesteren
http://annevankesteren.nl/

Received on Wednesday, 7 April 2010 14:58:43 UTC