Backtestsvuerun-20261007-145226#12124
defineCustomElement can accidentally override members of the Element prototype
Better
Our patch was judged better than the merged fix.
In this judgment, Patch A = our agent, Patch B = the merged fix.
Patch A fixes the root cause. Before defining a prop accessor, it checks the element's prototype chain (`isReservedCEKey`). If the member is read-only (such as `Element.prototype.tagName`), a method, or a VueElement internal, it skips the accessor and emits a dev warning. Writable native properties (e.g. `title`) and values set before upgrade can still be shadowed, so legitimate cases keep working. It also updates `patchProp` so that a Vue parent passing a conflicting prop sets it as an attribute instead, and the CE still receives the value. It tightens the `_setupExpose` check from `hasOwn` to `in`, so exposed members can no longer shadow native ones either. Its tests cover each of these paths: native read-only conflict, internal-member conflict, parent-rendered conflict, the writable-native allowance, and a pre-upgrade hyphenated prop. Each would fail without the change. One cost: conflicting props passed from a Vue parent become string attributes, so non-string values lose fidelity. That is a reasonable trade for not breaking the element. Patch B only adds a dev warning and still overwrites the native member. Its own tests assert that `e.tagName` becomes 'foo' and that `hasAttribute` is replaced by a plain object, which is exactly the breakage the issue complains about. A warning is one of the outcomes the reporter listed, so B is a minimal answer. But it leaves elements with broken `tagName` or methods in production, and its tests lock in the harmful behaviour. A prevents the problem while keeping the prop usable, 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
11m 12s
Wall-clock time in the container
Full test suite
No new failures
3,670 passed · 6 skipped · 3,676 total
Contamination audit
Clean
No sign the agent saw the real fix
Patch size
199vs 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.