[w3c/webcomponents] [idea] HTML Modules: Allow exporting without a script (#863)

(Copied from https://github.com/MicrosoftEdge/MSEdgeExplainers/issues/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` or `exportname` or `namedexport` (and `defaultexport`?) or something similar that allows elements to be exported without any inline scripts.
```html
<!-- module.html -->
<div namedexport="content">
Warning - this might hurt.
</div>
```
```js
// main.js
import {content} from "module.html";
document.body.appendChild(content);
```

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...
```html
<!-- Bonus -->
<!-- page.html -->
<content import="module.html" namedimport="content"></content>
```

A little bit like server-side includes. But this is crazy talk.


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/webcomponents/issues/863

Received on Wednesday, 8 January 2020 23:40:46 UTC