choojs / nanomorph

🚅 - Hyper fast diffing algorithm for real DOM nodes
MIT License
726 stars 58 forks source link

Fix child loop index #31

Closed rreusser closed 7 years ago

rreusser commented 7 years ago

This PR creates two new counters to handle adding and removing lists of nodes. It's test-driven development at its finest, which is to say I'm not 100% convinced it's correct, just that it handles the additional test cases.

See: #30

rreusser commented 7 years ago

I updated my example to use my local fork of nanomorph with this PR and it seems to work fine and fix the issue I was having with morphdom/yo-yo (which at this point I'm guessing was it using .setAttribute instead of .value =)

http://rickyreusser.com/control-panel-2/

kristoferjoseph commented 7 years ago

Thanks for fixing this and adding a test for regression avoidance.

Will be useful if when we attempt the firstChild + nextSibling walk.

rreusser commented 7 years ago

I've realized nanomorph is perhaps 40% more experimental than I first judged it to be, so I won't interfere too much since it looks like you're moving forward. Obv don't hesitate to blow away my fix in favor of more robust patching, but the test case seems legit. 😄

yoshuawuyts commented 7 years ago

v2.1.2 :sparkles: