refactor(runtime-dom): avoid unnecessary checks in patchDOMProp (#452)

This commit is contained in:
Cédric Exbrayat 2019-11-14 17:27:23 +01:00 committed by Evan You
parent 8e8397374c
commit 8688acc36f

View File

@ -12,11 +12,15 @@ export function patchDOMProp(
) {
if ((key === 'innerHTML' || key === 'textContent') && prevChildren != null) {
unmountChildren(prevChildren, parentComponent, parentSuspense)
el[key] = value == null ? '' : value
return
}
if (key === 'value' && el.tagName !== 'PROGRESS') {
// store value as _value as well since
// non-string values will be stringified.
el._value = value
el.value = value == null ? '' : value
return
}
if (value === '' && typeof el[key] === 'boolean') {
// e.g. <select multiple> compiles to { multiple: '' }