refactor(runtime-dom): avoid unnecessary checks in patchDOMProp (#452)
This commit is contained in:
parent
8e8397374c
commit
8688acc36f
@ -12,11 +12,15 @@ export function patchDOMProp(
|
|||||||
) {
|
) {
|
||||||
if ((key === 'innerHTML' || key === 'textContent') && prevChildren != null) {
|
if ((key === 'innerHTML' || key === 'textContent') && prevChildren != null) {
|
||||||
unmountChildren(prevChildren, parentComponent, parentSuspense)
|
unmountChildren(prevChildren, parentComponent, parentSuspense)
|
||||||
|
el[key] = value == null ? '' : value
|
||||||
|
return
|
||||||
}
|
}
|
||||||
if (key === 'value' && el.tagName !== 'PROGRESS') {
|
if (key === 'value' && el.tagName !== 'PROGRESS') {
|
||||||
// store value as _value as well since
|
// store value as _value as well since
|
||||||
// non-string values will be stringified.
|
// non-string values will be stringified.
|
||||||
el._value = value
|
el._value = value
|
||||||
|
el.value = value == null ? '' : value
|
||||||
|
return
|
||||||
}
|
}
|
||||||
if (value === '' && typeof el[key] === 'boolean') {
|
if (value === '' && typeof el[key] === 'boolean') {
|
||||||
// e.g. <select multiple> compiles to { multiple: '' }
|
// e.g. <select multiple> compiles to { multiple: '' }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user