Skip to content

Preact and custom elements #405

Closed
Closed

Description

@oskbor

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

Activity

  1. developit commented on Nov 15, 2016

    @developit
    Member

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

  2. oskbor commented on Nov 15, 2016

    @oskbor
    Author

    woho! that works very well for me 👍 thanks

  3. developit commented on Nov 15, 2016

    @developit
    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!!

  4. tconroy commented on May 13, 2017

    @tconroy

    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.

  5. oskbor commented on May 13, 2017

    @oskbor
    Author
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions