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

SSR: style binding keeps falsy values #9231

Closed
KaelWD opened this issue Dec 20, 2018 · 1 comment
Closed

SSR: style binding keeps falsy values #9231

KaelWD opened this issue Dec 20, 2018 · 1 comment
Labels

Comments

@KaelWD
Copy link
Contributor

KaelWD commented Dec 20, 2018

Version

2.5.21

Reproduction link

https://codesandbox.io/s/o95x14r0xz (I know, minimal repro below)

Steps to reproduce

View page source

What is expected?

<div class="v-responsive" style="height:480px;" data-v-2a183b29>

What is actually happening?

<div class="v-responsive" style="height:480px;max-height:undefined;max-width:undefined;width:undefined;" data-v-2a183b29>

Reproduce in vue/test/ssr/ssr-string.spec.js then run npm run test:ssr:

  it('falsy style value', done => {
    renderVmWithOptions({
      template: '<div :style="style"></div>',
      data: {
        style: {
          opacity: 0,
          color: null
        }
      }
    }, result => {
      expect(result).toContain(
        '<div data-server-rendered="true" style="opacity:0;></div>'
      )
      done()
    })
  })
@posva posva added the bug label Dec 20, 2018
yyx990803 added a commit that referenced this issue Jan 11, 2019
Ignores values that are not string or numbers, and append px as default
unit to appropriate properties.

There will still be certain cases where the user simply provides an
invalid string value to a property which will be too costly to detect
(it's possible by using the `cssstyle` package, but very heavy). But
in such cases the user would already notice the style is not working
on the client, so it's not really worth it for the perf implications.

fix #9231
@yyx990803
Copy link
Member

Closed via 7d9cfeb

f2009 pushed a commit to f2009/vue that referenced this issue Jan 25, 2019
Ignores values that are not string or numbers, and append px as default
unit to appropriate properties.

There will still be certain cases where the user simply provides an
invalid string value to a property which will be too costly to detect
(it's possible by using the `cssstyle` package, but very heavy). But
in such cases the user would already notice the style is not working
on the client, so it's not really worth it for the perf implications.

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

No branches or pull requests

3 participants