| 1017 | } |
| 1018 | |
| 1019 | const patchProps = ( |
| 1020 | el: RendererElement, |
| 1021 | oldProps: Data, |
| 1022 | newProps: Data, |
| 1023 | parentComponent: ComponentInternalInstance | null, |
| 1024 | namespace: ElementNamespace, |
| 1025 | ) => { |
| 1026 | if (oldProps !== newProps) { |
| 1027 | if (oldProps !== EMPTY_OBJ) { |
| 1028 | for (const key in oldProps) { |
| 1029 | if (!isReservedProp(key) && !(key in newProps)) { |
| 1030 | hostPatchProp( |
| 1031 | el, |
| 1032 | key, |
| 1033 | oldProps[key], |
| 1034 | null, |
| 1035 | namespace, |
| 1036 | parentComponent, |
| 1037 | ) |
| 1038 | } |
| 1039 | } |
| 1040 | } |
| 1041 | for (const key in newProps) { |
| 1042 | // empty string is not valid prop |
| 1043 | if (isReservedProp(key)) continue |
| 1044 | const next = newProps[key] |
| 1045 | const prev = oldProps[key] |
| 1046 | // defer patching value |
| 1047 | if (next !== prev && key !== 'value') { |
| 1048 | hostPatchProp(el, key, prev, next, namespace, parentComponent) |
| 1049 | } |
| 1050 | } |
| 1051 | if ('value' in newProps) { |
| 1052 | hostPatchProp(el, 'value', oldProps.value, newProps.value, namespace) |
| 1053 | } |
| 1054 | } |
| 1055 | } |
| 1056 | |
| 1057 | const processFragment = ( |
| 1058 | n1: VNode | null, |