salesforce / lwc

⚡️ LWC - A Blazing Fast, Enterprise-Grade Web Components Foundation
https://lwc.dev
Other
1.59k stars 386 forks source link

Allow ElementInternals/FACE without native custom element lifecycle #4251

Closed nolanlawson closed 3 weeks ago

nolanlawson commented 1 month ago

We tied together ElementInternals/FACe with native custom element lifecycle because it was convenient to implement. But it isn't strictly necessary to tie the two features together. One deals with native vs synthetic connectedCallback/disconnectedCallback (and incidentally renderedCallback), whereas the other deals with form*Callback (formResetCallback, formAssociatedCallback, etc.).

We can separate the two features, so that a component gets synthetic lifecycle hooks for the first group, but native lifecycle hooks for the second group. ("Synthetic" FACE callbacks makes no sense, since we don't need to support IE11, and such a feature was never implemented, so it's not needed for backwards compat.)

attachInternals has no relationship with callbacks either.

However, we do still want to restrict this to native shadow/light DOM components. There is no reason to use FACE/ElementInternals in synthetic shadow.

Related: #4249