Re: [WICG/webcomponents] Need a callback for when children changed or parser finished parsing children (#809)

Here's an attempt at a concrete proposal:

Define an event called `finishedparsingchildren`, whose behavior is:

> When a [Node](https://dom.spec.whatwg.org/#node) `node` is popped off the [stack of open elements](https://html.spec.whatwg.org/#stack-of-open-elements) of an [HTML parser](https://html.spec.whatwg.org/#html-parser) or [XML parser](https://html.spec.whatwg.org/#xml-parser), [queue an element task](https://html.spec.whatwg.org/#queue-an-element-task) on the [DOM manipulation task source](https://html.spec.whatwg.org/#dom-manipulation-task-source) given the `node` to [fire an event](https://dom.spec.whatwg.org/#concept-event-fire) named [finishedparsingchildren](https://html.spec.whatwg.org/#event-finishedparsingchildren) at `node`.

I believe that should be relatively straightforward to implement, and should address the use cases discussed in this issue. A few comments/variations:
 - The `finishedparsingchildren` event should not bubble, nor should it be cancelable.
 - Instead of queueing the event, it could be run synchronously, or at a different timing.
 - Perhaps the behavior could change depending on whether the parser was created as part of the [HTML fragment parsing algorithm](https://html.spec.whatwg.org/#html-fragment-parsing-algorithm). Either don't fire at all for fragment parsing, or fire with a different timing?

Thoughts?

-- 
Reply to this email directly or view it on GitHub:
https://github.com/WICG/webcomponents/issues/809#issuecomment-1456745320
You are receiving this because you are subscribed to this thread.

Message ID: <WICG/webcomponents/issues/809/1456745320@github.com>

Received on Monday, 6 March 2023 18:42:11 UTC