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

Custom Element only renders <style> tag in shadow root #821

Closed
mattdsteele opened this issue Sep 6, 2017 · 1 comment
Closed

Custom Element only renders <style> tag in shadow root #821

mattdsteele opened this issue Sep 6, 2017 · 1 comment

Comments

@mattdsteele
Copy link

I'm new to Svelte, but the ability to output Custom Elements is alluring! Bear with me if I'm not using it properly.

Repro: https://github.com/mattdsteele/polymer-cat-paw/tree/svelte

I made a <cat-paw> custom element (long story), which should have a shadow root that looks something like:

<style></style>
<img>

But I'm only seeing the <style> element get rendered inside the shadow root. This happens with native SD (Chrome) and in polyfill-land (Firefox).

I see the img tag's info in the compiled JS, but the create function isn't getting invoked. Do I need to do something more to bootstrap a custom element-ed Svelte component?

@Rich-Harris
Copy link
Member

Thanks for the report. This is basically a consequence of a test suite that wasn't built to handle custom elements — instead of testing the behaviour of them, we were reliant on checking that the compiled code made sense, which made it very easy for things like this to go unnoticed (new CustomElement(...) worked as expected, as did inline <CustomElement/> components, which are rendered as true custom elements, but el.innerHTML = <custom-element></custom-element> didn't).

#833 changes that in favour of testing in a real browser (via Nightmare), so we shouldn't see this bug again!

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