- From: James Browning <notifications@github.com>
- Date: Fri, 27 Sep 2024 23:51:35 -0700
- To: WICG/webcomponents <webcomponents@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Saturday, 28 September 2024 06:51:39 UTC
Something that still needs to be considered for HTML modules is how to manage [base urls](https://github.com/WICG/webcomponents/issues/581) for templates in HTML modules. For example if you're using a template from an HTML module to make a custom element like: ```html <!-- template.html --> <template export="default"> <link rel="stylesheet" href="./styles.css" /> <div id="someThing"></div> </template> ``` ```js import elTemplate from "./template.html"; class MyElement extends HTMLElement { #shadowRoot = this.#attachShadow({ mode: "closed" }); constructor() { super(); // OOPS the links are relative to the CURRENT document not to template.html this.#shadowRoot.append(elTemplate.content.cloneNode(true)); } } ``` then any links in your associated templates will refer to the current document not the document containing those templates. -- Reply to this email directly or view it on GitHub: https://github.com/WICG/webcomponents/issues/1059#issuecomment-2380434774 You are receiving this because you are subscribed to this thread. Message ID: <WICG/webcomponents/issues/1059/2380434774@github.com>
Received on Saturday, 28 September 2024 06:51:39 UTC