Backtestsvuerun-20261005-155915#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.
Patch A is the safer fix: it resolves the accidental-override problem with a dev warning and changes no runtime behavior. Correctness: The issue lists a warning as one acceptable outcome. Patch A adds a dev-only warning in `_resolveProps` whenever a declared prop key already exists on the element prototype. Runtime behavior stays the same, so the user is told about the conflict and nothing existing breaks. Patch B goes further and stops defining element properties for any prop whose name exists on the prototype chain. That catches very common prop names such as `title`, `id`, `hidden`, `lang` and `dir`. Two regressions follow: - Code that sets `el.title = someObject` from plain JS would silently hit the native setter. The value would be stringified and the Vue prop would never update. - `_setupExpose` changes from `hasOwn` to `key in this`, so exposed members that shadow inherited ones (e.g. an exposed `focus`) are now dropped. B patches `patchProp` to cover the Vue-parent rendering path, but the non-Vue JS property path, the main use of custom elements, loses functionality. Turning a dev-time naming mistake into silent runtime breakage for existing users is a significant risk. Tests: Both patches add tests that would fail before their change. A covers attribute-driven, reflected-attribute (`id`), and Vue-rendered (`hasAttribute`) conflicts, and checks that the warning fires. B's tests are thorough for its own semantics, but they lock in the breaking behavior. Scope and craft: A is minimal, follows existing warning conventions, and is easy to reason about. B touches three code paths (props, expose, `patchProp`). It adds a `@ts-expect-error` to reach a private field and widens the expose behavior change beyond the issue's ask, which adds risk.
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 40s
Wall-clock time in the container
Full test suite
No new failures
3,667 passed · 6 skipped · 3,673 total
Contamination audit
Clean
No sign the agent saw the real fix
Patch size
130vs 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.