-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Failed setting prop "size" on <input>: value 0 is invalid. #6616
Comments
see https://html.spec.whatwg.org/multipage/input.html#the-size-attribute
|
@edison1105 What does "if it is specified" have to do with it? Vue doesn't allow you to not specify a size. Behavior when: |
I see that the default value for the |
@edison1105 I reopened because I think we have some room for optimization here: core/packages/runtime-dom/src/modules/props.ts Lines 96 to 107 in 8772a01
This is the place that throws the warning. it does throw because it tries to do I think we can rewrite it like this? if (needRemove) {
el.removeAttribute(key)
}
else {
try {
el[key] = value
} catch (e: any) {
if (__DEV__) {
warn(
`Failed setting prop "${key}" on <${el.tagName.toLowerCase()}>: ` +
`value ${value} is invalid.`,
e
)
}
}
} However I'm not sure if the code as it is now was done to cover some other scenario. Also, I think we need a fix here - core/packages/runtime-dom/src/modules/props.ts Lines 55 to 69 in 8772a01
Again, not sure of the side effects from the top of my head. |
Looking at it again, this issue is even mentioned here in the comment in line 66. But I guess it does not work like intended because the type check is a bit all over the place:
|
Vue version
3.2.38
Link to minimal reproduction
https://codesandbox.io/s/peaceful-fermat-f8l7q1?file=/src/InputComponent.vue
Steps to reproduce
What is expected?
No warning.
What is actually happening?
Warning:
![image](https://user-images.githubusercontent.com/33786293/188888771-f0ad8c37-60fb-4998-9b81-ce272e18f02f.png)
System Info
No response
Any additional comments?
No response
The text was updated successfully, but these errors were encountered: