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

Pass the created HTML node to the preact component #76

Open
SowiSteve opened this issue Oct 6, 2022 · 1 comment
Open

Pass the created HTML node to the preact component #76

SowiSteve opened this issue Oct 6, 2022 · 1 comment

Comments

@SowiSteve
Copy link

Hi!

It would be very helpful if the custom element that is created in the register function also gets passed to the preact component (along with the attributes), so that it's possible to reference the actual DOM element inside of the preact component.

This would provide a clean way to e.g. fire events on the custom element itself, when scoped events are necessary. For example, if a web component uses events to communicate, and multiple instances of the same web component are loaded on the same page. If the events aren't scoped in that case (but e.g. all emitted on the document), it's impossible to figure out which player fired the event.

@rozek
Copy link

rozek commented Sep 15, 2023

can't you just use this.base.parentElement after componentDidMount ran? That's what I am doing in my code...

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