Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Script tag with html module? #13

Open
goldingdamien opened this issue Feb 25, 2019 · 1 comment
Open

Script tag with html module? #13

goldingdamien opened this issue Feb 25, 2019 · 1 comment

Comments

@goldingdamien
Copy link

The example shows a html module in a script tag:
https://github.com/PolymerLabs/html-modules-toolkit/blob/master/examples/common/src/index.html

Is there no limitation to what data can be represented by a script tag?
Can any data then be used?
Why is there a focus on "html"? Wouldn't a way to import any kind of file as a string be better(like https://github.com/webpack-contrib/raw-loader)?

@cdata
Copy link
Contributor

cdata commented May 17, 2019

@goldingdamien thanks for the question. If all you want to do is to import a file as a string, I would recommend the very handy Fetch API: https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API

<script> tags can be used to load many things. Indeed, there is a classic strategy for loading JSON across origins with a <script> called JSONP. The main limitation is that any content loaded with a <script> today is parsed as JavaScript.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants