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

> To avoid backward compatibility issues, opt-in with `const config = { closingTagEvent: true };` which would either emit on all closing tags, or only on nodes where `closingTagParsed === false` initially to reduce events emitted.

Agreed - the new record would need to be opt-in, both to avoid compat issues but also to avoid perf issues when it isn't in use.


> I'm still very uncomfortable with providing a close tag callback of any kind. It's an extreme special case a handful of built-in elements have (to the detriment of parser performance). It shouldn't be needed to create reusable custom elements that can be created through the parser or script.

I think the fact that several built-in elements on several browsers make use of such a functionality kind of proves it isn't an "extreme special case". It's maybe not the majority use case, but several real-world use cases have been mentioned above.

> And also, in the event the custom element creation was not parser-driven you'd have the exact same issue, but no solution, as you don't know when the `append()` calls will stop. So it's better to solve for that and then the parser case works too.

One thing to keep in mind that not all sites are using custom elements - the solution being proposed here works for both custom elements and non-custom elements.

> I suppose the problem here is that people don't want to provide incremental rendering for their elements

No, I don't think that's what people are looking for. People have some special cases where they **can't** provide incremental rendering, or it would be bad for their users. 

> ...but that is what all built-in elements provide and so custom elements should too.

No, not all built-in elements provide this. Let me ask you a question: let's say you were implementing the `<form>` element in WebKit. You want content to render as it streams in, but you only want to restore the form state once the full form is available, to avoid user confusion. Without the ability to know when the parser is done parsing the `</form>` tag, how would you do this? Webkit [currently does it exactly via the mechanism](https://sourcegraph.com/github.com/WebKit/WebKit/-/blob/Source/WebCore/html/HTMLFormElement.cpp?L934) being proposed here, so I'm asking about what alternative you'd use.

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

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

Received on Thursday, 12 October 2023 22:01:03 UTC