LearnNewsExamplesServices
Frontmatter
id8056
title[DomEvent] Implement Boundary-Aware Delegation Verification
stateClosed
labels
enhancementaiarchitecture
assigneestobiu
createdAtDec 8, 2025, 7:45 AM
updatedAtDec 8, 2025, 7:55 AM
githubUrlhttps://github.com/neomjs/neo/issues/8056
authortobiu
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtDec 8, 2025, 7:55 AM

[DomEvent] Implement Boundary-Aware Delegation Verification

Closed v11.17.0 enhancementaiarchitecture
tobiu
tobiu commented on Dec 8, 2025, 7:45 AM

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:

  1. 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.
  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.
tobiu added the enhancement label on Dec 8, 2025, 7:45 AM
tobiu added the ai label on Dec 8, 2025, 7:45 AM
tobiu added the architecture label on Dec 8, 2025, 7:45 AM
tobiu assigned to @tobiu on Dec 8, 2025, 7:45 AM
tobiu referenced in commit 1c735a2 - "[DomEvent] Implement Boundary-Aware Delegation Verification #8056" on Dec 8, 2025, 7:53 AM
tobiu closed this issue on Dec 8, 2025, 7:55 AM