element.createOutline vs <outline> or <toc> [was: adding a note to 4.3.10.1 Creating an outline]

Hi Silvia,

Silvia Pfeiffer <silviapfeiffer1@gmail.com>, 2014-02-27 22:07 +1100:

> Was it ever discussed to introduce an actual <outline> element (or
> maybe more appropriately a <toc> element)?

It wasn't as far as I remember.

It's not clear to me exactly what the generated content of such an element
would end up being. An <ol>? Or a <ul>? Or what? How would Web authors be
able to style it? (Would the contents be a shadow DOM or.. what?)

And what precedents do we have for an element like <outline> or <toc>?
(that is, one that would inject some text content into one part of a
document by constructing it from some other parts of the  document)

So I think rather than an element it would be a lot clearer and easier to
just start out by adding an element.createOutline method that simply
constructs an Outline object and returns it. Web authors could then take
that object and do whatever they want with it as far a markup and styling
and putting something back into the DOM.

I think Web authors would still want such a thing even if we were ever to
also provide an <outline> or <toc> element.

> I think it would be a worthwhile discussion for a HTML5.1 feature if
> there was implementor interest and it could make use of the outlining
> algorithm, making it actually useful.
 
Silvia Pfeiffer <silviapfeiffer1@gmail.com>, 2014-02-28 11:13 +1100:

> On Fri, Feb 28, 2014 at 11:02 AM, Michael[tm] Smith <mike@w3.org> wrote:
> > However, there is already a JavaScript library that follows the spec to
> > provide an "HTML5Outline(element)" method that returns an outline object
> > for a subtree or whole document -- depending on what element you give it --
> > (and as a bonus an outline.asHTML convenience method to generate an HTML
> > representation of an outline) -
> 
> I like that idea, but I would prefer it to be declarative since it has
> clear rendering consequences.

It doesn't necessarily have rendering consequences unless we choose to make
it have them. It doesn't even need to have any effect on the DOM.

So I'd prefer that rather than starting out with something declarative we
just start out with a primitive element.createOutline method -- in part for
the same reason you gave: Because otherwise we also have to deal with
figuring out the rendering consequences. And in part because rightly it
seems like we'd still need one anyway, even if we were to add an element.

  --Mike

-- 
Michael[tm] Smith http://people.w3.org/mike

Received on Friday, 28 February 2014 01:00:38 UTC