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

Preact and custom elements #405

Closed
oskbor opened this issue Nov 15, 2016 · 5 comments
Closed

Preact and custom elements #405

oskbor opened this issue Nov 15, 2016 · 5 comments

Comments

@oskbor
Copy link

oskbor commented Nov 15, 2016

Hello,
I have a native custom element, lets call it <custom-video-player>.
It handles its own children. The children can be a <video> or an <image> for example.
Unfortunately preact clobbers the child dom that I create in my createdCallback and the entire component breaks.
Is there an option I can pass in to make preact accept the component as it is and not traverse its children?
I am guessing this is related/identical to #39

@developit
Copy link
Member

This is fixed in version 7. npm I preact@beta.
Also I believe it only affects polyfilled custom Elements.

@oskbor
Copy link
Author

oskbor commented Nov 15, 2016

woho! that works very well for me 👍 thanks

@oskbor oskbor closed this as completed Nov 15, 2016
@developit
Copy link
Member

Awesome, I really appreciate you opening this issue since I didn't have time to manually test this fix out myself. I was convinced it would work and I'm happy it does! Thanks @oskbor!!

@tconroy
Copy link

tconroy commented May 13, 2017

Hi @oskbor -- I'm running into a similar issue you described (mine is #344). So my custom elements are rendering as-expected on initial page render, but when navigating to subsequent views (in a SPA etc), they stop updating.

They also maintain their own internal nodes, and after inspecting the nodes it seems like there contents have been wiped out. Seems like Preact is breaking the shadow dom for custom elements.

Wondering if you had to do anything in addition to get this working aside from just bumping preact version? I've tried the latest versions and still running into issues. :(

Any input much appreciated.

@oskbor
Copy link
Author

oskbor commented May 13, 2017 via email

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

3 participants