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

Inert scripts not running for custom elements when loaded via <link rel="import"> #128

Closed
DirectXMan12 opened this issue May 11, 2013 · 2 comments
Labels

Comments

@DirectXMan12
Copy link

When you have an element like this

<element name="x-cheese">
  <template>
    <script>
      alert('hi');
    </script>
  </template>
</element>

The script in the template is inert, and should run when the template is inserted as ShadowDOM into any <x-cheese> element. However, this only occurs when the elements are declared inline; when the elements are imported via <link rel="import">, the inert script does not get activated.

Browser: Chromium 28.0.1496.0 (Developer Build 197749)
OS: Linux
Blink: 537.36 (Unknown URL@0)
JavaScript: V8 3.18.5.2

Experimental features enabled (e.g. native ShadowDOM, etc)

@sjmiles
Copy link
Contributor

sjmiles commented May 14, 2013

I'm not sure this is really going to be supported. There is after all an elaborate mechanism for attaching code to the instancing of a custom element (which has evolved to avoid all kinds of messy problems). In any case, if it doesn't work under native ShadowDOM and you think it should, you may have to file a bug here: https://www.w3.org/Bugs/Public/showdependencytree.cgi?id=14978

@sorvell
Copy link
Contributor

sorvell commented Jun 14, 2013

This is due to the way HTMLImports is polyfilled. Imports are retrieved, a new document is made, and the html for that document is set via innerHTML. For security reasons, script nodes generated in this way do not execute. The native implementation of HTMLImports should run these scripts.

Unless there's a compelling reason, we do not plan to correct this behavior.

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

No branches or pull requests

3 participants