- From: Justin Fagnani <notifications@github.com>
- Date: Fri, 10 Oct 2025 15:33:04 -0700
- To: WICG/webcomponents <webcomponents@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Friday, 10 October 2025 22:33:08 UTC
justinfagnani left a comment (WICG/webcomponents#814) @EisenbergEffect I really think that this is a perfect use case for mixins. If we ever get "behaviors" that add instance properties, then that would be most easily explainable by putting something on the prototype chain with those properties, rather than monkey-patching the instance. I'm not sure if a button behavior would add additional methods, but I could see _some_ behavior eventually needing to do that. Mixins would be as easy to apply, and would naturally compose: ```ts export class UIButton extends HTMLButtonBehavior(HTMLElement) { constructor() { super(); this.attachShadow({ mode: "open" }); this.shadowRoot.innerHTML = "<slot></slot>"; this.shadowRoot.adoptedStyleSheets.push(buttonStyles); } } ``` -- Reply to this email directly or view it on GitHub: https://github.com/WICG/webcomponents/issues/814#issuecomment-3392493005 You are receiving this because you are subscribed to this thread. Message ID: <WICG/webcomponents/issues/814/3392493005@github.com>
Received on Friday, 10 October 2025 22:33:08 UTC