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
[idea] HTML Modules: Allow exporting without a script #863
(Copied from MicrosoftEdge/MSEdgeExplainers#9, which has some additional discussion before leaving the issue for future consideration; filing here to ensure it gets properly recorded.)
Define a new HTML content attribute, export or exportname or namedexport (and defaultexport?) or something similar that allows elements to be exported without any inline scripts.
<!-- module.html --><divnamedexport="content">
Warning - this might hurt.
</div>
A little bit like server-side includes. But this is crazy talk.
Reacted by Justin Fagnani, Bruce B. Anderson, Theresa O’Connor, Pierre-Marie Dartus, Krzysztof Maczyński, kwangure, Oliver Williams, Anton, Jesse Pence, Daniel Herr and 1 more
but I've seen a lot of requests for this to be built in.
One reason I'm interested is because it could work inside <noscript> and give content to people with scripts turned off but without sending superfluous content to people who don't need it.
Or perhaps it should be a DocumentFragment. Or it could throw an error if there are more than one child. Not sure. I think having an element dedicated to this would be better than an attribute however.
Activity
justinfagnani commentedon Jan 9, 2020
+1
This was included in our strawman here: #645 (comment)
For modules that contain only templates, this is a great simplification for providing the exports.
Also a huge fan of
<content>(under a different name, likely, due to WCv0). I have a custom element that addresses that too: https://www.npmjs.com/package/html-include-element but I've seen a lot of requests for this to be built in.Jamesernator commentedon Jan 9, 2020
One reason I'm interested is because it could work inside
<noscript>and give content to people with scripts turned off but without sending superfluous content to people who don't need it.bahrus commentedon Jan 10, 2020
I'd also like to see support for lazy loading, like iFrames, images now have.
My suggestion for syntax is here (WIP).
sashafirsov commentedon Aug 11, 2021
Take a look into HTC. Declarative definitions of input parameters, exported functionality, ... up to packaging into deployment archive.
adrianhelvik commentedon Jan 22, 2022
Spitballing:
template.html
index.html (possibly)
Or perhaps it should be a DocumentFragment. Or it could throw an error if there are more than one child. Not sure. I think having an element dedicated to this would be better than an attribute however.
adrianhelvik commentedon Jan 22, 2022
Then again I think should probably be added in a separate proposal.
sashafirsov commentedon Dec 7, 2023
It would be handy to list proposals of the syntax and their compliance against existing use.
#idis already used by SVG to get elements and partially by HTML url to point the element without extraction. There are more of use for URI with hash.<define name="my-element" export>from HTML modules strawmanexportorexportnameornamedexport,defaultexport.