( parentDom: Element, lastChildren, nextChildren, context: object, isSvg: boolean )
| 99 | } |
| 100 | |
| 101 | function patchArrayChildren ( |
| 102 | parentDom: Element, |
| 103 | lastChildren, |
| 104 | nextChildren, |
| 105 | context: object, |
| 106 | isSvg: boolean |
| 107 | ) { |
| 108 | const lastLength = lastChildren.length |
| 109 | const nextLength = nextChildren.length |
| 110 | if (lastLength === 0) { |
| 111 | if (nextLength > 0) { |
| 112 | for (let i = 0; i < nextLength; i++) { |
| 113 | mountChild(nextChildren[i], parentDom, context, isSvg) |
| 114 | } |
| 115 | } |
| 116 | } else if (nextLength === 0) { |
| 117 | unmountChildren(lastChildren) |
| 118 | parentDom.textContent = '' |
| 119 | } else { |
| 120 | if (isKeyed(lastChildren, nextChildren)) { |
| 121 | patchKeyedChildren( |
| 122 | lastChildren, |
| 123 | nextChildren, |
| 124 | parentDom, |
| 125 | context, |
| 126 | isSvg, |
| 127 | lastLength, |
| 128 | nextLength |
| 129 | ) |
| 130 | } else { |
| 131 | patchNonKeyedChildren( |
| 132 | parentDom, |
| 133 | lastChildren, |
| 134 | nextChildren, |
| 135 | context, |
| 136 | isSvg, |
| 137 | lastLength, |
| 138 | nextLength |
| 139 | ) |
| 140 | } |
| 141 | } |
| 142 | } |
| 143 | |
| 144 | export function patchChildren ( |
| 145 | parentDom: Element, |
no test coverage detected