MCPcopy Create free account
hub / github.com/Nynxz/ComfyUI-IdeogramHelper / patchElement

Function patchElement

web/main.js:4914–4993  ·  view source on GitHub ↗
(n1, n2, parentComponent, parentSuspense, namespace, slotScopeIds, optimized)

Source from the content-addressed store, hash-verified

4912 }
4913 };
4914 const patchElement = (n1, n2, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
4915 const el = n2.el = n1.el;
4916 let { patchFlag, dynamicChildren, dirs } = n2;
4917 patchFlag |= n1.patchFlag & 16;
4918 const oldProps = n1.props || EMPTY_OBJ;
4919 const newProps = n2.props || EMPTY_OBJ;
4920 let vnodeHook;
4921 parentComponent && toggleRecurse(parentComponent, false);
4922 if (vnodeHook = newProps.onVnodeBeforeUpdate) {
4923 invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
4924 }
4925 if (dirs) {
4926 invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
4927 }
4928 parentComponent && toggleRecurse(parentComponent, true);
4929 if (oldProps.innerHTML && newProps.innerHTML == null || oldProps.textContent && newProps.textContent == null) {
4930 hostSetElementText(el, "");
4931 }
4932 if (dynamicChildren) {
4933 patchBlockChildren(
4934 n1.dynamicChildren,
4935 dynamicChildren,
4936 el,
4937 parentComponent,
4938 parentSuspense,
4939 resolveChildrenNamespace(n2, namespace),
4940 slotScopeIds
4941 );
4942 } else if (!optimized) {
4943 patchChildren(
4944 n1,
4945 n2,
4946 el,
4947 null,
4948 parentComponent,
4949 parentSuspense,
4950 resolveChildrenNamespace(n2, namespace),
4951 slotScopeIds,
4952 false
4953 );
4954 }
4955 if (patchFlag > 0) {
4956 if (patchFlag & 16) {
4957 patchProps(el, oldProps, newProps, parentComponent, namespace);
4958 } else {
4959 if (patchFlag & 2) {
4960 if (oldProps.class !== newProps.class) {
4961 hostPatchProp(el, "class", null, newProps.class, namespace);
4962 }
4963 }
4964 if (patchFlag & 4) {
4965 hostPatchProp(el, "style", oldProps.style, newProps.style, namespace);
4966 }
4967 if (patchFlag & 8) {
4968 const propsToUpdate = n2.dynamicProps;
4969 for (let i = 0; i < propsToUpdate.length; i++) {
4970 const key = propsToUpdate[i];
4971 const prev = oldProps[key];

Callers 1

processElementFunction · 0.85

Calls 7

toggleRecurseFunction · 0.85
invokeVNodeHookFunction · 0.85
invokeDirectiveHookFunction · 0.85
patchBlockChildrenFunction · 0.85
resolveChildrenNamespaceFunction · 0.85
patchChildrenFunction · 0.85
patchPropsFunction · 0.85

Tested by

no test coverage detected