mirror of https://github.com/vuejs/core.git
fix(runtime-dom): handle undefined values in v-html (#11403)
This commit is contained in:
parent
c7f5c70eba
commit
5df67e3675
|
@ -152,6 +152,12 @@ describe('runtime-dom: props patching', () => {
|
|||
expect(root.innerHTML).toBe(`<div><del>baz</del></div>`)
|
||||
})
|
||||
|
||||
test('patch innerHTML porp w/ undefined value', async () => {
|
||||
const root = document.createElement('div')
|
||||
render(h('div', { innerHTML: undefined }), root)
|
||||
expect(root.innerHTML).toBe(`<div></div>`)
|
||||
})
|
||||
|
||||
test('textContent unmount prev children', () => {
|
||||
const fn = vi.fn()
|
||||
const comp = {
|
||||
|
|
|
@ -15,7 +15,7 @@ export function patchDOMProp(
|
|||
if (key === 'innerHTML' || key === 'textContent') {
|
||||
// null value case is handled in renderer patchElement before patching
|
||||
// children
|
||||
if (value === null) return
|
||||
if (value == null) return
|
||||
el[key] = value
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue