On Fri, Mar 22, 2013 at 7:47 AM, Michael[tm] Smith <mike@w3.org> wrote:
> Silvia Pfeiffer <silviapfeiffer1@gmail.com>, 2013-03-22 07:36 +1100:
>
> > How about something more constructive such as an explicit <outline>
> element
> > that creates a table of contents through the outline algorithm.
>
> I think just adding a createOutline method would be better. It would return
> an Outline object that's a tree of Section objects. The developer could
> then choose what HTML they want to use to actually get the outline into the
> DOM (e.g., ul/li or ol/li or whatever).
>
> You could do document.document.element.createOutline() to get an Outline
> object for the whole document, or
> document.getElementById("foo").createOutline()
> (or with querySelector or whatever) to create an Outline object for some
> portion of a document (one use case being if you want to generate
> per-section or per-chapter TOCs in a long document).
>
We could do both. The <outline> element would create a shadow dom, but a
createOutline() method would just create the list of sections and leave
formatting to the developer. All of those limitations could also apply to
<outline> within a section.
Just brainstorming here - this needs properly thinking through. But it also
means that the outline algorithm suddenly becomes useful and is not just a
suggestion for how to create an outline from the DOM.
Silvia.