Backtestsvuerun-20261002-115633#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 walks the prototype chain and skips read-only accessors and methods inherited from the element, such as `tagName` and `hasAttribute`. It warns in dev, and the prop stays settable through its attribute. It also updates `patchProp`, so a Vue parent passing a conflicting prop goes straight to `_setProp` rather than trying to assign the read-only native property, which would otherwise fail. Writable native members like `title` and `tabIndex` can still be set as properties, which preserves existing behavior. Its tests cover the attribute path, the Vue-parent path, and the writable-member case. They assert that `tagName` stays native (`'MY-EL-PROPS-CONFLICT'`) while the shadow content updates, so they would fail without the fix. Patch B only adds a dev warning and still overwrites the native member. Its own test asserts `e.tagName === 'foo'` and that `hasAttribute` is replaced by the prop value, which locks in the harmful behavior the issue reports. Overwriting methods like `hasAttribute` can break the DOM and Vue's own internals. B's check `key in Object.getPrototypeOf(this)` also warns on harmless writable reflected properties such as `id`. B is a symptom-level mitigation at best. A is more complex, but the added logic is targeted and well tested.
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
12m 45s
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
156vs 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.