-
Notifications
You must be signed in to change notification settings - Fork 378
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
[idea] HTML Modules: Allow exporting without a script #863
Comments
+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 |
One reason I'm interested is because it could work inside |
I'd also like to see support for lazy loading, like iFrames, images now have. My suggestion for syntax is here (WIP). |
Take a look into HTC. Declarative definitions of input parameters, exported functionality, ... up to packaging into deployment archive. |
Spitballing: template.html <export name="default">
<template>
Hello, I am a template!
</template>
</export> index.html (possibly) <script type="module">
import template from './template.html'
console.log(template instanceof HTMLTemplateElement) // true
</script>
<import name="default" src="./template.html"> 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. |
Then again I think should probably be added in a separate proposal. |
It would be handy to list proposals of the syntax and their compliance against existing use.
|
(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.)
Originally filed by @phistuck:
Define a new HTML content attribute,
export
orexportname
ornamedexport
(anddefaultexport
?) or something similar that allows elements to be exported without any inline scripts.I imagine some HTML modules might have no scripting logic, they would only exist to share content and inline scripts are too wordy for those cases.
That could maybe make them available from HTML directly as well...
A little bit like server-side includes. But this is crazy talk.
The text was updated successfully, but these errors were encountered: