W3C home > Mailing lists > Public > whatwg@whatwg.org > April 2011

[whatwg] <summary> and <details> elements' specification

From: Tomasz Jamroszczak <toja@opera.com>
Date: Mon, 11 Apr 2011 15:40:41 +0200
Message-ID: <op.vtrz90t3rkwrfs@herring.wroclaw.osa>

	I've got another proposal for making <summary> and <details> easier to  
implement and - what's more important - easier to understand and thus  
easier to use.
	Instead of making <summary> inside <details> working as <legend> inside  
<fieldset>, we can throw away the <details> tag and make <summary> work  
like <label> element with form element.  There's no need for "open"  
attribute, instead already existing "hidden" attribute can be used on any  
HTML element.  Clicking on <summary> adds or removes "hidden" attribute  
 from element with given id.

	Here's default UA style:

summary {
   display: list-item;
   list-style-type: -o-disclosure-closed;
}
[hidden] {
   display: none;
}

	Here's example HTML:

<summary for="detailsId">This is summary. Click to show/close  
details.</summary>
<div id="detailsId" hidden>...</div>

Pros:
1. Simple to understand by web page authors - its representation and  
semantics play well together.
2. No XBL involved.
3. Nicely rendered by browsers not supporting <summary> tag.
4. No quirky rendering.
5. Less keywords to memorize by web authors, reusing existing keywords in  
semantically correct way.
Cons:
6. Error-prone for web developers using copy-and-paste method.
7. Additional burden for web developer to maintain summary - id matching.   
It's equivalent of absent <summary> element in current specification.
8. Magic when it comes to displaying expand marker inside <summary>.

-- 
Best Regards,
Tomasz Jamroszczak
Received on Monday, 11 April 2011 06:40:41 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 30 January 2013 18:48:03 GMT