Skip to content
This repository has been archived by the owner on Nov 22, 2018. It is now read-only.

disconnectedCallback and parentNode #12

Closed
Prinzhorn opened this issue Mar 22, 2018 · 4 comments
Closed

disconnectedCallback and parentNode #12

Prinzhorn opened this issue Mar 22, 2018 · 4 comments
Labels
bug Something isn't working core

Comments

@Prinzhorn
Copy link
Owner

Currently we detach every single behavior when an element is disconnected. However, the dependency check uses el.parentNode. We should have a special mode for detaching/cleaning up everything. This is different from regular batch detaching.

@Prinzhorn Prinzhorn added bug Something isn't working core labels Mar 22, 2018
@Prinzhorn
Copy link
Owner Author

This goes even further. The LayoutDependencyType needs to be updated when an element leaves or enters the DOM. Maybe we just update EVERYTHING when an element disconnects or connects? Or is that overkill? Maybe it only affects the layout behavior anyway. Or maybe not. There might be behaviors (e.g. signal) that search for events using a selector. It needs to be updated as well.

@Prinzhorn
Copy link
Owner Author

What we basically need to do is to call _updateProperty for dependencies with the same rawValue (e.g. inherit). This will get the correct elements from the DOM and the guide-layout will automatically do its thing due to layout:update event.

@Prinzhorn
Copy link
Owner Author

Now the thing is that this should be a general purpose solution. Right now we have layoutdependency and template that depend on the DOM. There will be at least a third one cssselector. These should all be updated when a new element (MeisterComponent) connects or disconnects from the DOM. This is not related to the layout behavior at all, it's just the first place that we ran into it.

Prinzhorn added a commit that referenced this issue Apr 10, 2018
@Prinzhorn
Copy link
Owner Author

Now we're talking: if you create a new disconnected element-meister the behaviors will crash, since they expect the element to be connected. Luckily, there is a isConnected property and we can postpone behavior scheduling.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working core
Projects
None yet
Development

No branches or pull requests

1 participant