Commit fb92c298 authored by Sindre Sorhus's avatar Sindre Sorhus

Switch out [].remove() with [].splice()

parent e24eae60
// Array Remove - By John Resig (MIT Licensed)
Array.prototype.remove = function( from, to ) {
var rest = this.slice( ( to || from ) + 1 || this.length );
this.length = from < 0 ? this.length + from : from;
return this.push.apply( this, rest );
};
/* /*
By Sindre Sorhus (c) [Sindre Sorhus](http://sindresorhus.com)
sindresorhus.com
*/ */
jQuery(function($){
jQuery(function($) { jQuery(function($) {
"use strict"; "use strict";
...@@ -102,7 +92,7 @@ jQuery(function($) { ...@@ -102,7 +92,7 @@ jQuery(function($) {
l = todos.length; l = todos.length;
while ( l-- ) { while ( l-- ) {
if ( todos[l].done ) { if ( todos[l].done ) {
todos.remove(l); todos.splice( l, 1 );
} }
} }
App.render(); App.render();
...@@ -155,7 +145,7 @@ jQuery(function($) { ...@@ -155,7 +145,7 @@ jQuery(function($) {
}, },
destroy: function() { destroy: function() {
App.getTodo( this, function(i) { App.getTodo( this, function(i) {
this.todos.remove(i); this.todos.splice( i, 1 );
this.render(); this.render();
}); });
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment