[Bug 15455] <details> elements without a child <summary> element should automatically get one (not just a text label)

https://www.w3.org/Bugs/Public/show_bug.cgi?id=15455

--- Comment #1 from Mathias Bynens <mathias@qiwi.be> 2012-01-08 10:44:55 UTC ---
> The first `summary` element child of the element, if any, represents the summary or legend of the
> details. If there is no child `summary` element, the user agent should provide its own legend (e.g. 
> "Details").

It would be infinitely more useful if <details> elements without a child
<summary> element would automatically get a <summary> element inserted with the
default text content of “Details”, rather than just a text label.

Currently it’s not possible to easily select the inserted text label in CSS or
JavaScript (AFAIK) and style it or bind event handlers to it.

Changing this would make it much easier to polyfill <details>/<summary> in this
case, as we could then rely on the <summary> element being there in all cases.

To clarify, what I’m proposing here is that…

    <details><p>Foo</p></details>

…generates the following DOM:

    <details>
      <summary>Details</summary>
      <p>Foo</p>
    </details>

…instead of:

    <details>
      Details
      <p>Foo</p>
    </details>

-- 
Configure bugmail: https://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

Received on Sunday, 8 January 2012 10:45:01 UTC