-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cloneNode and Custom Elements #9
Comments
Maybe you can add thoughts to this old thread, if you have any: WICG/webcomponents#176 |
I'm pretty sure cloneNode only happens on initial instantiation of template instances. So when a template is drawn the first time or an new row is added to list. Given the use of a string templating I'm not sure where JS props would come into the picture. The node is cloned then binding is applied to the clone, and then that clone attached to the DOM. Basically the template being cloned from is abstracted from you , and you'd only ever interface with the clone and it is never cloned again. I'm yet to hit an issue using Custom Elements this way using this cloneNode method as used in DomC. Mind you the Custom Elements I use do most of their work in the Connected Callback instead of the constructor (historically reasons to support backward compatible polyfills in ES5). Have you seen an example of this being a problem? I'm actually pretty interested as I use this exact same approach in my libraries. |
As of now, Domc hasn't been tested with Custom Elements, nor designed with it in mind. |
I should add that lit-html and lighterhtml also use this approach of setting templates and cloning them. Both libraries known to support custom elements. So unless you have found a specific issue I do not imagine there should be any issue with the approach taken here. Not to say Domc might not have other hangups with web components, just that the cloneNode part is fairly ubiquitous. |
I just can't state that they are supported or tested, until test them myself. Upd: |
i have created tag-html as succesor of lit-html with webcomponents in mind i will adapt domc as additional algo as my framework supports dirrent algos to be modular and flexible i can expect how to handle all that with domc support as my tag-html famework is also string template based but it uses tagged template literals. it replaces lit-html directives with customElements support |
My fear is that using Custom Elements in
domc
(which usescloneNode
) will result in errors/bugs due to certain things like JS props not being cloned to the new nodes. Thoughts on this?The text was updated successfully, but these errors were encountered: