luwes / js-diff-benchmark

Simple benchmark for testing your DOM diffing algorithm.
67 stars 5 forks source link

Fix Snabbdom assertions #23

Closed luwes closed 4 years ago

luwes commented 4 years ago

2 assertions are failing for Snabbdom

Screen Shot 2020-04-17 at 7 38 22 PM
blankhart commented 4 years ago

The issue is in the fast insertion path on this line, which assumes an append at afterNode. Instead, that block should append at a[start_i] || afterNode:

    if (start_i > end_i) { // old list exhausted; process new list additions
      for (; start_j <= end_j; start_b = b[++start_j]) {
        parent.insertBefore(start_b, a[start_i] || afterNode);  // not afterNode
      }
    }
WebReflection commented 4 years ago

@blankhart thanks!