Matt-Esch / virtual-dom

A Virtual DOM and diffing algorithm
MIT License
11.66k stars 779 forks source link

An diff algorithm confusion #434

Closed chs97 closed 7 years ago

chs97 commented 7 years ago

https://github.com/Matt-Esch/virtual-dom/blob/master/vtree/diff.js line 222

let a = [ {key: 1}, {key: 2}, {key:3} ] let b = [ {key: 3}, {key: 2}, {key:1}, {key: 5} ] reorder(a, b) the result is insert 2 items and remove 2items I think it should remove 2 items and insert 3items Is the data legal?