-
Notifications
You must be signed in to change notification settings - Fork 2k
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
External element scripts not loading #216
Comments
Script tags are not supported as direct children of |
@sjmiles eg my-element.html <element name="my-element" attributes="name">
<link rel="stylesheet" href="my-element.css" />
<template>
<span>Hello {{name}}!</span>
</template>
</element>
<script src="my-element.js" type="text/javascript"></script> No dice :( |
If that did work or is supported behavior, that would imho be a very poor design choice. The aesthetic I see of this is two-fold - the "MVC" of "Markup/Style/Script" is present, but separated by concern into individual files. At the same time, it's centralized in the markup itself, by an element containing a |
Is Script tags as you show are supported and the tests are passing. If you are sure it's not working, we will need more information on your situation. |
The four files are in the same directory, with content exactly as shown. They are served via The test you mention is https://github.com/Polymer/HTMLImports/blob/stable/test/html/parser.html I presume? Do I need to include the HTMLImports and CustomElement polyfills directly? I was under the impression that those were included in |
Yes. But I will run some more tests and see if I can repro your problem.
No, those are included in |
PR27 on Platform is a test case that demonstrates the current state of this issue. It seems that while the script is loading and being run, the element never gets registered? Certainly, the registered callback doesn't get called, and visually the page never renders the element. |
Remember this statement:
Your test is still attempting to use |
The error is the same in either commit. What is the reasoning for not supporting script tags as a child of |
If there is a related problem when using |
Referencing scripts using a src attribute for a script tag inside an element tag never loads.
my-element.html
my-element.js
my-element.css
index.html
Moving the script inside the script tag and removing the src attribute causes the example to behave correctly.
(Chrome Version 28.0.1500.71 on Fedora 19)
The text was updated successfully, but these errors were encountered: