-
-
Notifications
You must be signed in to change notification settings - Fork 113
fix #198: connected/disconnected events cannot dispatch to nested component #199
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
Conversation
…to nested components
Added coverage files. |
thanks for the PR but please not so easy ... I don't want events to dispatch twice if a parent with a connected callback has children with connected callbacks and there is no test around this PR. Can we have a test case that ensure things work as expected and the parent doesn't trigger twice? |
Hi @WebReflection , I don't understand why parent connected callback is triggered multiple times. I wrote the test case the parent connected callback is triggered multiple times (bubbling). But in real project it's only triggered once. Theoretically the CONNECTED & DISCONNECTED events would not bubble by default. Because the new Event has bubbles options default to false. I added test case to cover the events test. Could you help to have a look why it's not working? Thanks. |
@liming it could be an issue in basicHTML. Look, I might just merge this and figure out how to fix that but I'd like to be aligned on what we think should be the expected behaviour accordingly to this change
In top down order, the parent is connected and after its children but as bubbling/setup order one might expect children to fire before the parent ... or not? I'm a bit puzzled, please help me with this and I'll merge your changes, fix the issue, and push the new version. Thank You! |
@liming I've counter-verified indeed there was a bug in basicHTML, now fixed (but it's not in here yet, will push changes ASAP) |
@liming done. If you could put in the Apologies for the inconvenient. |
Hi @WebReflection , I updated the package.json and test cases works! Thanks for the fix. It's good to merge and release a new patch :) |
@liming please give me some quick thoughts on this comment and I'll eventually merge and release, thanks. |
Hi @WebReflection , The onconnect event is reflecting the sequence of DOM creation, in which the parents are created before children. Bubbling is the children letting their parent know something happened about themselves. If parents received an onconnect event bubbled from its child, this onconnect is actually say the child get birth instead of parent itself. The target of this event would be child but not parent. We are talking about DOM creation order in regards to onconnect event. I think it make sense for parents receive the event before its children. Does the explain make you less puzzled? |
published as |
This PR is trying to fix #198