I'm not really sold on Robin's "view" idea. I'm not sure we need this to be any more complex then just, we expose a way to create a static outline on demand, which consists of an "Outline" object that's just a tree of "Section" nodes—where the spec would need to define what a Section node is (simple to define), and from that define what an Outline is (even simpler to define).
For an existing JS implementation that pretty much does exactly that, see Dominykas Blyžė’s h5o HTML5 outliner code, in particular, his code for the
HTML5Outline(*element*) method here:
But if we were to standardize it, I think that instead of that approach, it should just be a new method for HTMLElement, so that you could just create an Outline object with
element.createOutline() (so, with no args needed).
However I wouldn't object to instead just exposing it as a standard
document.createOutline(*element*) method (i.e., basically just what Dominykas's
HTML5Outline(*element*) method does.
Implicit in all that of course is that we'd want to provide developers with the flexibility to create an outline not just for the entire document, but from any arbitrary subtree of the document, with whatever element they want at the root of the outline.