- From: edbaafi <notifications@github.com>
- Date: Tue, 25 Feb 2025 17:13:05 -0800
- To: WICG/webcomponents <webcomponents@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <WICG/webcomponents/issues/645/2683647108@github.com>
edbaafi left a comment (WICG/webcomponents#645) @justinfagnani thanks for this. > Scripts are indeed the toughest question, IMO, because they have to be addressed in any attempt at this feature, MVP or no. > If scripts don't run in the first cut, they can't suddenly run in a future update. If they run in the first cut, we have to get the semantics correct in a forward-compatible way, including whether or not exports from inline scripts become exports in the HTML module and a few other things. I think if this starts as an MVP without deciding on the script question then this question is very similar to the `@import`question for the CSS side of import attributes. They ended up warning not throwing IIRC and this post stuck out: https://github.com/WICG/webcomponents/issues/870#issuecomment-719119713 Particularly the part about if we throw now but start supporting this later what does that mean? I think for imports with `{type: 'html'}`, it means we couldn't polyfill (at runtime I mean) the potentially new behavior (i.e. eventually allowing scripts) for browsers that decided to throw now. It would take some monkey patching but if the template is allowed to be imported with a disabled script, we could probably patch cloneNode to detect an instance of HTMLTemplateElement's content property and to find any scripts and re-add them to cause them to load similar to how I showed above (for the case where scripts added with innerHTML don't load). The feasibility of such a patch might depend on the semantics, but at least there is a possible way forward. What do we lose by not throwing? A developer who makes a mistake today (doing something the spec and a warning can tell them not to do) causes their code to work differently at some later point. I think this is acceptable because they can fix that issue, but we can't take back browsers that ship with behavior that blocks a way forward (Safari especially). > I would love to see some incremental way to start Agreed, I think a major use case is enabled by just allowing this syntax for loading html templates without dealing with the script question. At least at first glance I think warning not throwing like was done for `@import` with `{type: 'css'}` leaves us with the most flexibility. The warning is that you have a script that is currently not loading but could in the future so leave it there at your own risk. Thoughts? -- Reply to this email directly or view it on GitHub: https://github.com/WICG/webcomponents/issues/645#issuecomment-2683647108 You are receiving this because you are subscribed to this thread. Message ID: <WICG/webcomponents/issues/645/2683647108@github.com>
Received on Wednesday, 26 February 2025 01:13:09 UTC