Backtestsvuerun-20261009-161443#12124
defineCustomElement can accidentally override members of the Element prototype
Worse
The merged fix was judged better than our patch.
In this judgment, Patch B = our agent, Patch A = the merged fix.
The issue's main complaint is that Vue silently overrides native Element members like `tagName`. It explicitly accepts a warning as a remedy. Patch A adds a dev-only warning when a declared prop name already exists on the element's prototype. The prop/property behavior stays exactly as before, so existing code keeps working. Its tests cover the reported `tagName` case, a reflected native property (`id`), and a native method (`hasAttribute`) set from a Vue render. Each asserts the warning, and those assertions would fail without the change. Patch B goes further. It stops defining accessors for any prop that collides with something in the prototype chain, routes Vue-rendered bindings for those props through a new patchProp branch, and also changes `_applyExpose` to skip anything in the prototype chain. That stops the override, but it is a silent breaking change for common prop names like `title`, `hidden`, `lang`, `dir` and `id`. JS code doing `el.title = someObject` used to set the Vue prop. Now it hits the native setter, which stringifies the value and only reaches the prop indirectly through attribute reflection. For non-reflected native members it doesn't reach the prop at all. The expose change similarly alters existing behavior for names like `focus`. The extra patchProp branch adds complexity and runs before the existing `.`/`^`/shouldSetAsProp logic, which adds risk on a hot path. B's tests are thorough, but they lock in this riskier semantic change. Patch A satisfies the issue's ask with minimal risk. Patch B's broader redesign introduces regressions for existing users, so A is the better fix.
The judge saw only the two patches, labelled A and B in random order, with issue links and version numbers removed. The reasoning above is shown verbatim.
Solve
6m
Wall-clock time in the container
Full test suite
No new failures
701 passed · 1 skipped · 702 total
Contamination audit
Clean
No sign the agent saw the real fix
Patch size
149vs 79 merged
Changed lines, ours vs merged
The issue
View on GitHubVue version
3.4.5
Link to minimal reproduction
https://stackblitz.com/edit/vitejs-vite-aob5zf?file=index.html
Steps to reproduce
I defined a Vue component with tagName as a property, and used that, together with defineCustomElement to define the hello-world webcomponent.