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
I searched for an existing RRFC which might be relevant to my RRFC
Motivation
Some developers would like to create a loader for a set of components that will automatically load element definitions as they are used. This is useful when you have a very large component set hosted on a CDN, so there's no specific module graph to load individual elements from, and you don't want to require your HTML-authoring users to write a script tag for every element they use.
It's a feature of Stencil, and Shoelace has built their own loader system.
In the case my-element-1, and my-element-3 would be loaded, but not my-element-2.
How
The basic approach is to register a stub element that loads the real definition when the first instance is created. The stub should contain static metadata needed for the definition like observed attributes, form association, etc.
Another approach would be to use a mutation observer, but that would only work in one HTML tree scope at a time. It would be fine for the main document.
I'm just here to say that I appreciate the direction this is indicating. We were thinking about building something like that ourselves, but an "official" solution would be much appreciated
Motivation
Some developers would like to create a loader for a set of components that will automatically load element definitions as they are used. This is useful when you have a very large component set hosted on a CDN, so there's no specific module graph to load individual elements from, and you don't want to require your HTML-authoring users to write a script tag for every element they use.
It's a feature of Stencil, and Shoelace has built their own loader system.
Example
In the case
my-element-1
, andmy-element-3
would be loaded, but notmy-element-2
.How
The basic approach is to register a stub element that loads the real definition when the first instance is created. The stub should contain static metadata needed for the definition like observed attributes, form association, etc.
We made an experiment for this a while back: https://github.com/PolymerLabs/split-element
Another approach would be to use a mutation observer, but that would only work in one HTML tree scope at a time. It would be fine for the main document.
Current Behavior
We have no lazy loading solution
Desired Behavior
References
The text was updated successfully, but these errors were encountered: