This weekend saw the minting of not one but two new elements. The
summary element (not the
summary attribute on the
table element) goes inside the
<details> <summary>More information</summary> <p>Here is the source data that is discussed in the article ... </p> </details>
This is designed to produce an “expando” box that is closed by default (but can be open by default using the boolean
open attribute), only displaying the text specified by the
summary as a control. Activating that control opens the whole
details element; re-activating closes it again. If no
summary text is present, the browser defaults to the rubric “details”. (Added 4 Feb 10:) In browsers that support
figcaption lives inside the
<figure> <img ... > (or
tableetc) <figcaption>A rabid unicorn goring a fairy.</figcaption> </figure>
If you want some history, continue reading. Otherwise, bye bye!
legend element was specified to do the job of both. Unfortunately, every browser had parsing problems re-using it outside forms. Similar problems were encountered attempting to re-use the
caption element outside tables. At Jeremy Keith’s suggestion, the spec then re-used
dt, but that breaks too.
Now, two new elements are minted. (I quite fancied one new element –
rubric for both, but it’s a pretty esoteric word.)
One of the objections to
details, as described by Shelley Powers in her bug to remove it is
In fact, I don’t see how this element will make developing web applications that much simpler. This type of functionality is trivial with JS.
display:none by default, and the user cannot expand the information without JS, thereby making the contents inaccessible if JS is not present.
Reinstating this element would be advantageous to developers, who wouldn’t need to learn JS to accomplish a common task; advantageous to users who would get an accessibility bonus from having this behaviour natively in the browser.
While I like to think that the irrefutable logic of my argument, coupled with the tear-jerking rhetorical flourishes in my prose captured both the heart and the head of the editor, I suspect what persuaded him was Apple’s Maciej Stachowiak saying that “the webkit community” were interested in implementing
details once the spec was nailed down. Implementation wins the day.