Update Neo.manager.DomEvent.verifyDelegationPath to implement a robust, boundary-aware check for event delegation.
Current Behavior:
The current implementation only verifies delegation targets against the physical DOM path. This causes verification failures for "logically" bubbled events (e.g., from a DragProxy to a Dashboard) where the target is not in the listener's physical DOM ancestry.
Proposed Strategy:
Implement a two-phase verification process to balance performance and correctness:
Phase 1: Physical Boundary Check (The Fast Path)
- Iterate the raw
event.path provided by the browser.
- Check if the
delegationTarget is physically contained within the listener.vnodeId.
- If yes: Return valid (covers ~99% of cases with O(N) performance).
- If the loop ends without finding the listener's node: We have crossed a physical/logical boundary. Proceed to Phase 2.
Phase 2: Logical VNode Verification (The Fallback)
- This phase runs only when the physical check fails.
- Retrieve the listener's component instance.
- Use
Neo.util.VNode.getById(listenerComponent.vnode, targetId) to verify if the delegation target exists within the listener's current logical VNode tree.
- Note:
Neo.util.VNode.getById already correctly handles recursion and resolves component references (via getVnode), so it will "tunnel" into child component VNodes as needed.
Implementation Details:
- Modify
src/manager/DomEvent.mjs.
- Ensure
Neo.util.VNode is imported (typically as VNodeUtil).
- The fallback check should verify that
targetId is findable starting from listener.vnodeId within the listener component's VNode tree.
Update
Neo.manager.DomEvent.verifyDelegationPathto implement a robust, boundary-aware check for event delegation.Current Behavior: The current implementation only verifies delegation targets against the physical DOM path. This causes verification failures for "logically" bubbled events (e.g., from a DragProxy to a Dashboard) where the target is not in the listener's physical DOM ancestry.
Proposed Strategy: Implement a two-phase verification process to balance performance and correctness:
Phase 1: Physical Boundary Check (The Fast Path)
event.pathprovided by the browser.delegationTargetis physically contained within thelistener.vnodeId.Phase 2: Logical VNode Verification (The Fallback)
Neo.util.VNode.getById(listenerComponent.vnode, targetId)to verify if the delegation target exists within the listener's current logical VNode tree.Neo.util.VNode.getByIdalready correctly handles recursion and resolves component references (viagetVnode), so it will "tunnel" into child component VNodes as needed.Implementation Details:
src/manager/DomEvent.mjs.Neo.util.VNodeis imported (typically asVNodeUtil).targetIdis findable starting fromlistener.vnodeIdwithin the listener component's VNode tree.