Failed to set the 'size' property on 'HTMLInputElement': The value provided is 0, which is an invalid size.
Version
3.0.5
Reproduction link
I have no idea how to reproduce without the full, actual repo.
Steps to reproduce
No idea, but seems like it has something to do with patchDOMProp setting el[key] = 0
What is expected?
To work normally
What is actually happening?
An error is thrown and nothing happens
The warning:
runtime-core.esm-bundler.js?5c40:38 [Vue warn]: Unhandled error during execution of scheduler flush. This is likely a Vue internals bug. Please open an issue at https://new-issue.vuejs.org/?repo=vuejs/vue-next
at <AppInput class="name-input" modelValue="" onUpdate:modelValue=fn
The error:
runtime-dom.esm-bundler.js?830f:212 Uncaught (in promise) DOMException: Failed to set the 'size' property on 'HTMLInputElement': The value provided is 0, which is an invalid size.
at patchDOMProp (webpack-internal:///./node_modules/@vue/runtime-dom/dist/runtime-dom.esm-bundler.js:423:21)
at patchProp (webpack-internal:///./node_modules/@vue/runtime-dom/dist/runtime-dom.esm-bundler.js:552:17)
at mountElement (webpack-internal:///./node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js:3927:25)
at processElement (webpack-internal:///./node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js:3899:13)
at patch (webpack-internal:///./node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js:3819:21)
at mountChildren (webpack-internal:///./node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js:3995:13)
at mountElement (webpack-internal:///./node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js:3918:17)
at processElement (webpack-internal:///./node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js:3899:13)
at patch (webpack-internal:///./node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js:3819:21)
at mountChildren (webpack-internal:///./node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js:3995:13)
patchDOMProp @ runtime-dom.esm-bundler.js?830f:212
patchProp @ runtime-dom.esm-bundler.js?830f:341
mountElement @ runtime-core.esm-bundler.js?5c40:3826
processElement @ runtime-core.esm-bundler.js?5c40:3789
patch @ runtime-core.esm-bundler.js?5c40:3709
mountChildren @ runtime-core.esm-bundler.js?5c40:3894
mountElement @ runtime-core.esm-bundler.js?5c40:3817
processElement @ runtime-core.esm-bundler.js?5c40:3789
patch @ runtime-core.esm-bundler.js?5c40:3709
mountChildren @ runtime-core.esm-bundler.js?5c40:3894
mountElement @ runtime-core.esm-bundler.js?5c40:3817
processElement @ runtime-core.esm-bundler.js?5c40:3789
patch @ runtime-core.esm-bundler.js?5c40:3709
mountChildren @ runtime-core.esm-bundler.js?5c40:3894
mountElement @ runtime-core.esm-bundler.js?5c40:3817
processElement @ runtime-core.esm-bundler.js?5c40:3789
patch @ runtime-core.esm-bundler.js?5c40:3709
componentEffect @ runtime-core.esm-bundler.js?5c40:4211
reactiveEffect @ reactivity.esm-bundler.js?a1e9:42
effect @ reactivity.esm-bundler.js?a1e9:17
setupRenderEffect @ runtime-core.esm-bundler.js?5c40:4176
mountComponent @ runtime-core.esm-bundler.js?5c40:4134
processComponent @ runtime-core.esm-bundler.js?5c40:4094
patch @ runtime-core.esm-bundler.js?5c40:3712
mountChildren @ runtime-core.esm-bundler.js?5c40:3894
mountElement @ runtime-core.esm-bundler.js?5c40:3817
processElement @ runtime-core.esm-bundler.js?5c40:3789
patch @ runtime-core.esm-bundler.js?5c40:3709
mountChildren @ runtime-core.esm-bundler.js?5c40:3894
mountElement @ runtime-core.esm-bundler.js?5c40:3817
Promise.then (async)
queueFlush @ runtime-core.esm-bundler.js?5c40:264
queueJob @ runtime-core.esm-bundler.js?5c40:258
run @ reactivity.esm-bundler.js?a1e9:183
trigger @ reactivity.esm-bundler.js?a1e9:189
set @ reactivity.esm-bundler.js?a1e9:288
arrayInstrumentations.
An absolute minimum would be to share the code of the AppInput
component as that's where the error happens.
Please read https://new-issue.vuejs.org/?repo=vuejs/vue-next#why-repro and open a new issue with a reproduction.
Remember to use the forum or the Discord chat to ask questions!
the size
value must be greater than 0, you should check your code to avoid this.
see https://developer.mozilla.org/zh-CN/docs/Web/HTML/Element/input#attr-size
@LinusBorg @posva
Hey, I just worked out to reproduce the issue.
@edison1105 is correct. The problem is a template of <input :size="0">
. However, this did not cause an issue in Vue 2.
I think the minimum is removing the Vue warning that says "open an issue" in this case. WDYT?
this did not cause an issue in Vue 2.
because we used el.setAttribute(key,value)
in Vue 2 and changed to el[key] = value
in Vue 3.
I think this is expected.you should avoid to set <input :size="0">