-
Notifications
You must be signed in to change notification settings - Fork 12
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
Event bubbling #8
Comments
I understand the use case but EventTarget has no concept of a |
Fair point, but there is a concept of "get the parent": https://dom.spec.whatwg.org/#ref-for-get-the-parent Maybe this could this be used? I see in linkedom there is a getter for It feels "expected" that the dispatching of the event would take care of the event bubbling and that it could be in |
thing is ... this is kinda the TC39 standard answer to NodeJS emitter ... and emitter has no concept for |
I'm confused as to why I could look into linkedom code instead if you think that's more relevant. As to why I'm doing that, in my company we are looking for alternative solutions to jsdom and I find linkedom concept very interesting. My goal was to see what I could do to use linkedom in unit tests and contribute if that works for you. |
in NodeJS a
it's a valid issue, imho, I'm just trying to understand where it fits the best. the
extending was my thinking, yes
it does, so keep it coming, and please bear with me, it's just that |
Perfect, that works for me and I get your point now 👍 I've been reading Node discussion about their implementation of EventTarget and it is expected to have null "get the parent" algorithm by default which is the case here (more on that: nodejs/node#33556 (comment)). Thanks for your answers! |
I started looking at extending EventTarget and putting the bubbling aside there are still some aspects of the implementation that are limiting:
|
Thanks for looking into this. Here my answer:
I start thinking maybe it's worth rewriting this module from scratch for LinkeDOM only as things might be much simpler, as the target is NodeJS, not browsers / others. |
P.S. in node there is also native |
I agree, looking at the code extending Node's EventTarget could work, I have to check it. About bubbling, I'd like to keep it simple unless there is a need for more. And if needs arise it can be improved later |
Done a quick check, only v16 has EventTarget ... so I'd still use this module as base class, extend it as I'll fix the |
What is the issue?
Currently when dispatching an event to a node, that event won't bubble up to parents.
This is also used in linkedom which is the reason I started looking at it.
What could be done?
I pulled the code and started an update:
This is a very simple bubbling but it should works fine and could be improved in more PR eventually.
I created a branch, maybe I could push it and create a PR?
Thanks!
The text was updated successfully, but these errors were encountered: