Support <script src="...."> in web component templates?
danieldietrich opened this issue · comments
Currently, the component processor only reads <script>
contents. It would be nice to by able to load scripts dynamically. Maybe we can just leave the <script>
tags in the DOM (resp. as part of the template) and the browser does the job when cloning the template to the custom element root?
I see the following problems with that approach:
- a
<script src="...">
cannot bindthis
. we currently rely on that because a script sees the component's__ctx
object asthis
. I don't see how this should work... - when a component is loaded from a different location, a relative url in
src
does not point to the right resource anymore. we could fix that by rewriting relative urls with the right base-url
See also #20