- From: br3nt <notifications@github.com>
- Date: Sun, 20 Oct 2024 14:40:55 -0700
- To: WICG/webcomponents <webcomponents@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <WICG/webcomponents/issues/1081/2425236444@github.com>
Thank you everyone for the in-depth explanations. I need to do some experimentation to see if I'll be affected by some of these cases due to the specific way I'm creating custom elements. For background, I am building a templating library that allows mixing JS and HTML to create custom elements similar to what you see in back-end template libraries like Ruby's ERB, and ASP.NETs Razor where native code is mixed with HTML. I suspect I'll encounter several roadblocks on this journey. An example I have working is: ```html <html> <head> <script type="module" src="../jst.js"></script> </head> <script type="jst" name="jst-counter" count :increment> $ const clicks = count == 1 ? 'click' : 'clicks' <button onmousedown="$increment">$(count || 0) $clicks</button> </script> <body> <jst-counter count="5" :increment="incrementCounter(this)"></jst-counter> <script> function incrementCounter(el) { ++el.attributes.count.value } </script> </body> ``` I next want to implement slots, however, based on the feedback from @WebReflection, I now suspect I will encounter issues with this: ```html <html> <head> <script type="module" src="../jst.js"></script> </head> <script type="jst" name="jst-condition" condition> $ if (condition) { <slot name="true"></slot> $ } else { <slot name="false"></slot> $ } </script> <body> <script> const someVar = true; <script> <jst-condition condition="someVar"> <span slot="true">someVar was true</span> <span slot="true">someVar was false</span> </jst-condition> </body> ``` The user should be able to do anything custom elements can like extend other classes, and the myriad of other custom element features that exists: ```html <script type="jst" name="jst-checkbox" extend="HTMLInputElement" extend-type="HTMLInputElement"> ...content... </script> ``` Effectively, I', trying to create a declarative way of writing custom elements. -- Reply to this email directly or view it on GitHub: https://github.com/WICG/webcomponents/issues/1081#issuecomment-2425236444 You are receiving this because you are subscribed to this thread. Message ID: <WICG/webcomponents/issues/1081/2425236444@github.com>
Received on Sunday, 20 October 2024 21:40:59 UTC