Skip to content

add undefined handler to event with modifier in loop will cause error #14361

@AlexRen94

Description

@AlexRen94

Vue version

3.5.26

Link to minimal reproduction

https://play.vuejs.org/#eNp9U01v1DAQ/SuDL9mVSiIEp212BVSVgAMgQOKAOaTZSerWsS3b2a4U5b93bCfpblX1Fs978+bNRwb2yZj80CPbsNLVVhgPDn1vdlyJzmjrYQCLDYzQWN1BRtRsgX4YL7S60rLvFEyEvDiNBunsErjiqtbKeehcC9uguMq+oJQa/mor92+yNVdlkQxQaXp47IysPNILoLx9txuGmDyOZUGvGBXK9B4Obzu9R7nljHDOoEjgmbkQK4sTTXbBvCNLjWjzO6cV9T+ENM5q3Rkh0aZ8x9kGIhKwihw/fIsxb3u8mOP1Ldb3L8Tv3DHEOPtp0aE9IGcL5ivbok/w9e/veKTvBaSOeknsV8Bf6Ki34DHRPvdqT7ZPeNHt17gqodo/7vroUbm5qWA0MMfI54w2dfVK60923+cfYh5XI03x+bbDIZ3v7qb3XitaU6MtLUnHBBAK0heVgY+1FPV97rw2CyPXBm2V+otCAMMwQarqcCQDpF4k+ef7nY9ZVqolSR+qzIedLnGqTtf4LwhNjQblDWQ3lc2mOS42NrBaw3Y3MwGCjpaYS92usoUWOgvp68vEizbTkM9rNFq/UIO2iI1QuJ9m/J9kTv4MNj4CMl48Wg==

Steps to reproduce

Adding undefined to event handler with modifier in for loop will cause error. Minimal reproduction demo is given in link above.
There is an almost same issue before #9865, which has been fixed.
While in for loop, this issue still exists and will cause failure.

What is expected?

Like issue in #9865, vue should ignore empty event handler with modifier in for loop

What is actually happening?

sfc fails to render if adding undefined handler to event with modifier in loop

System Info

System:
    OS: macOS 26.2
    CPU: (10) arm64 Apple M1 Pro
    Memory: 177.27 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.12.0 - /Users/alexren/.nvm/versions/node/v22.12.0/bin/node
    npm: 11.0.0 - /Users/alexren/.nvm/versions/node/v22.12.0/bin/npm
    pnpm: 9.15.5 - /Users/alexren/Library/pnpm/pnpm
  Browsers:
    Chrome: 144.0.7559.97
    Edge: 129.0.2792.79
    Safari: 26.2
  npmPackages:
    vue: ~3.5.26 => 3.5.26

Any additional comments?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    🔨 p3-minor-bugPriority 3: this fixes a bug, but is an edge case that only affects very specific usage.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions