MCPcopy
hub / github.com/vuejs/core / patchProps

Function patchProps

packages/runtime-core/src/renderer.ts:1019–1055  ·  view source on GitHub ↗
(
    el: RendererElement,
    oldProps: Data,
    newProps: Data,
    parentComponent: ComponentInternalInstance | null,
    namespace: ElementNamespace,
  )

Source from the content-addressed store, hash-verified

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,

Callers 1

patchElementFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected