You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Improve docs for custom elements, destructors #688
So Unpoly allows to define custom HTML elements (here the loading-indicator)? Is there another parts of the docs that talks about it?
the return [] of an array seems undocumented elsewhere. The compiler is supposed to return a function, where you can clean up/destroy things when the element is un-mouunted. Is there other parts of the docs that talks about it ?
So Unpoly allows to define custom HTML elements (here the loading-indicator)?
You can compile arbitrary CSS selectors so it works on your own custom elements, too. Can be ergonimic way if you just need to initialize some JS. If you need to do more (e.g. open a shadow root or attach element internals), the canonical customElements.define() will work, too.
I'm make a guide page for that. Also how to have custom form fields participate in form submissions etc.
the return [] of an array seems undocumented elsewhere. The compiler is supposed to return a function, where you can clean up/destroy things when the element is un-mouunted. Is there other parts of the docs that talks about it ?
You can also return an array of functions. Useful when you need to undo multiple things. I'm going to make a pass over the destructor docs.
Activity
[-]Docs : custom components and compiler[/-][+]Improve docs for custom elements, destructors[/+]triskweline commentedon Dec 16, 2024
Good catch, all of this needs to be documented.
You can compile arbitrary CSS selectors so it works on your own custom elements, too. Can be ergonimic way if you just need to initialize some JS. If you need to do more (e.g. open a shadow root or attach element internals), the canonical
customElements.define()will work, too.I'm make a guide page for that. Also how to have custom form fields participate in form submissions etc.
You can also return an array of functions. Useful when you need to undo multiple things. I'm going to make a pass over the destructor docs.