Skip to content

Commit

Permalink
fix: fix(ssr) textarea domProps keeps falsy values (vuejs#10803)
Browse files Browse the repository at this point in the history
  • Loading branch information
lKk2 committed Feb 12, 2020
1 parent 6390f70 commit 288c671
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/platforms/web/server/modules/dom-props.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default function renderDOMProps (node: VNodeWithData): string {
setText(node, props[key], true)
} else if (key === 'textContent') {
setText(node, props[key], false)
} else if (key === 'value' && node.tag === 'textarea') {
} else if (props[key] && key === 'value' && node.tag === 'textarea') {
setText(node, props[key], false)
} else {
// $flow-disable-line (WTF?)
Expand Down
20 changes: 20 additions & 0 deletions test/ssr/ssr-string.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1222,6 +1222,26 @@ describe('SSR: renderToString', () => {
})
})

// SSR: textarea domProps keeps falsy values #10803
it('falsy domProps value', done => {
renderVmWithOptions({
render(h) {
return h('div', [
h('textarea', {
domProps: {
value: null
}
})
])
}
}, result => {
expect(result).toContain(
'<div data-server-rendered="true"><textarea></textarea></div>'
)
done()
})
})

it('render v-model with <select> (value binding)', done => {
renderVmWithOptions({
data: {
Expand Down

0 comments on commit 288c671

Please sign in to comment.