Active-CSS / active-css

The epic event-driven browser language for UI with functionality in one-liner CSS. Over 100 incredible CSS commands for DOM manipulation, ajax, reactive variables, single-page application routing, and lots more. Could CSS be the JavaScript framework of the future?
https://activecss.org
Other
42 stars 7 forks source link

Inherited event scope for target selectors no longer available when the component is removed - 2.5.0 issue #107

Closed bob2517 closed 3 years ago

bob2517 commented 3 years ago

This is an interesting side-effect of the inherited event scope aspect for private components of Active CSS. When you delete a component and trigger inherited events (in parent components) after the call stack with "after stack", the internals have lost memory of the target scope and so don't do anything.

I'm just thinking aloud on this one to work out what to do.

The correct behaviour is to use the parent's scope regardless of whether the inner component scope exists. Which is data gotten from the component itself currently, so it's not available when the component is removed.

We do know that the correct event is definitely being run, so it obviously is in the right scope, it just doesn't know what scope to run the target selectors in. So I think the handling is that if the component is no longer there, then use the scope of the parent to locate the targets. This is a very specific issue related to privateEvent component event inheritance.

Should have a fix committed shortly.

bob2517 commented 3 years ago

Specific handling will be the adding of the upper scope root to the main action object, so it's available when passed to a delayed custom event. Then in theory it's just a case of using that upper root for locating target selectors if the component root element was removed.

bob2517 commented 3 years ago

Fix is on the branch.