- From: Michael Warren <notifications@github.com>
- Date: Sun, 11 Feb 2024 12:17:54 -0800
- To: WICG/webcomponents <webcomponents@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Sunday, 11 February 2024 20:18:00 UTC
+1 to this idea. Another thing that I'd like to advocate for with `slotchange` enhancements is that a slot change event also trigger for direct child slotted element attributes and text node changes. I know that detecting attribute/property/text node changes is a slippery slope because of depth and performance issues. That said, if the `slotchange` would fire when existing slotted DOM elements attributes/textContent change, that would be a huge help to web component developers. **Rationale** A lot (all?) front end template frameworks will try to intelligently re-use DOM elements when state updates cause DOM re-renders. I know for a fact that both React and Lit intelligently re-use DOM when possible. If slotted children of a web component are re-used by a framework re-render cycle and thereby only the attributes/textContent are changed, `slotchange` won't fire and the component depending on `slotchange` won't behave accordingly. Currently developers that consume web components implemented wth `slotchange` have to jump through hoops to make sure that DOM isn't re-used so that `slotchange` can fire successfully. -- Reply to this email directly or view it on GitHub: https://github.com/WICG/webcomponents/issues/1042#issuecomment-1937858130 You are receiving this because you are subscribed to this thread. Message ID: <WICG/webcomponents/issues/1042/1937858130@github.com>
Received on Sunday, 11 February 2024 20:18:00 UTC