(
c1: VNode[],
c2: VNodeArrayChildren,
container: RendererElement,
parentAnchor: RendererNode | null,
parentComponent: ComponentInternalInstance | null,
parentSuspense: SuspenseBoundary | null,
namespace: ElementNamespace,
slotScopeIds: string[] | null,
optimized: boolean,
)
| 1802 | |
| 1803 | // can be all-keyed or mixed |
| 1804 | const patchKeyedChildren = ( |
| 1805 | c1: VNode[], |
| 1806 | c2: VNodeArrayChildren, |
| 1807 | container: RendererElement, |
| 1808 | parentAnchor: RendererNode | null, |
| 1809 | parentComponent: ComponentInternalInstance | null, |
| 1810 | parentSuspense: SuspenseBoundary | null, |
| 1811 | namespace: ElementNamespace, |
| 1812 | slotScopeIds: string[] | null, |
| 1813 | optimized: boolean, |
| 1814 | ) => { |
| 1815 | let i = 0 |
| 1816 | const l2 = c2.length |
| 1817 | let e1 = c1.length - 1 // prev ending index |
| 1818 | let e2 = l2 - 1 // next ending index |
| 1819 | |
| 1820 | // 1. sync from start |
| 1821 | // (a b) c |
| 1822 | // (a b) d e |
| 1823 | while (i <= e1 && i <= e2) { |
| 1824 | const n1 = c1[i] |
| 1825 | const n2 = (c2[i] = optimized |
| 1826 | ? cloneIfMounted(c2[i] as VNode) |
| 1827 | : normalizeVNode(c2[i])) |
| 1828 | if (isSameVNodeType(n1, n2)) { |
| 1829 | patch( |
| 1830 | n1, |
| 1831 | n2, |
| 1832 | container, |
| 1833 | null, |
| 1834 | parentComponent, |
| 1835 | parentSuspense, |
| 1836 | namespace, |
| 1837 | slotScopeIds, |
| 1838 | optimized, |
| 1839 | ) |
| 1840 | } else { |
| 1841 | break |
| 1842 | } |
| 1843 | i++ |
| 1844 | } |
| 1845 | |
| 1846 | // 2. sync from end |
| 1847 | // a (b c) |
| 1848 | // d e (b c) |
| 1849 | while (i <= e1 && i <= e2) { |
| 1850 | const n1 = c1[e1] |
| 1851 | const n2 = (c2[e2] = optimized |
| 1852 | ? cloneIfMounted(c2[e2] as VNode) |
| 1853 | : normalizeVNode(c2[e2])) |
| 1854 | if (isSameVNodeType(n1, n2)) { |
| 1855 | patch( |
| 1856 | n1, |
| 1857 | n2, |
| 1858 | container, |
| 1859 | null, |
| 1860 | parentComponent, |
| 1861 | parentSuspense, |
no test coverage detected