mirror of https://github.com/toddmotto/echo.git
Browse Source
`[].slice.call(foo)` returns an array that is a copy of the array-like `foo`, so when you splice it in this code, you're splicing (and then throwing away) a copy of store. I have edited the code to go ahead and slice the nodeList straight off (which saves cycles _and_ code) and then do the splicing on that directly, so your elements actually do get removed. Also, every time you splice an element out, all of the elements in the array after it get renumbered, so the next iteration ends up skipping an element. An easy remedy to this is to run the loop in reverse, so only previously-iterated elements get renumbered. This also removes the need to check indexOf, as the element in question will never be out of bounds.pull/15/head
Michael Cordingley
11 years ago
1 changed files with 5 additions and 8 deletions
Loading…
Reference in new issue