Skip to content
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

Type of VNodeData style property should accept string values #9727

Closed
VitorLuizC opened this issue Mar 17, 2019 · 5 comments · Fixed by #9728
Closed

Type of VNodeData style property should accept string values #9727

VitorLuizC opened this issue Mar 17, 2019 · 5 comments · Fixed by #9728

Comments

@VitorLuizC
Copy link
Contributor

Version

2.6.9

Reproduction link

https://codesandbox.io/s/pkpkn7ljym

Steps to reproduce

Just try to use a string value for VNodeData's style property.

What is expected?

Vue handle string values for style, so types should allow the same.

What is actually happening?

Type of VNodeData's style don't accept string values.


@flow type declarations has same issue.

@VitorLuizC VitorLuizC mentioned this issue Mar 17, 2019
13 tasks
@posva
Copy link
Member

posva commented Mar 17, 2019

when do you have a string property in style? Are you creating or modifying existing vnodes (they are read-only)

@posva posva added the has PR label Mar 17, 2019
@VitorLuizC
Copy link
Contributor Author

When I'm creating them. The problems happens exactly when I'm creating components with createElement and VNodeData's style can't be string, even Vue supporting it.

@posva
Copy link
Member

posva commented Mar 17, 2019

Ok, I was confused because you directly used the type on a variable instead of passing the object with not type to h

@VitorLuizC
Copy link
Contributor Author

Sorry, my example may be bad.

I also found on sources the function where Vue handle string values for style bindings (if it help).

export function normalizeStyleBinding (bindingStyle: any): ?Object {
if (Array.isArray(bindingStyle)) {
return toObject(bindingStyle)
}
if (typeof bindingStyle === 'string') {
return parseStyleText(bindingStyle)

@posva
Copy link
Member

posva commented Mar 17, 2019

It was good already, but thanks for sharing :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants