- From: Ashley (Scirra) <notifications@github.com>
- Date: Sat, 02 Sep 2017 03:35:35 -0700
- To: w3c/webcomponents <webcomponents@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Saturday, 2 September 2017 10:36:01 UTC
Having thought about this a bit more I think @TakayoshiKochi is right in approaching this with just a built-in `import doc from './foo.html' as DocumentFragment` as a MVP. With workarounds you can do a sort of poor-man's replacement for HTML imports/modules like this:
```js
import doc from "./foo.html" as DocumentFragment;
// instead of: import templateElem from "./foo.html" as Selector("#template")
const templateElem = doc.getElementById("#template");
// instead of: import style from "./foo.css" as MainDocumentStyle
someLibraryFunctionToAddStyle("foo.css");
```
This does start to open the door to making a JS Module that also references DOM elements and style. It does seem a lot easier to try to make the module JS-centric rather than HTML-centric. Adding style is still awkward (especially since it is async), but that could be improved later.
So, +1 from me to spec importing as DocumentFragment and then see where we go from there.
--
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/645#issuecomment-326736159
Received on Saturday, 2 September 2017 10:36:01 UTC