Skip to content

Commit

Permalink
update $.fn.remove to work with latest .each
Browse files Browse the repository at this point in the history
  • Loading branch information
enure committed Jan 21, 2011
1 parent 1ff401a commit d84eab6
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions src/assets.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
(function($){
var cache = [], timeout;

$.fn.remove = function(){
return this.each(function(element){
if(element.tagName == 'IMG'){
cache.push(element);
element.src = 'data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=';
if (timeout) clearTimeout(timeout);
timeout = setTimeout(function(){ cache = [] }, 60000);
}
element.parentNode.removeChild(element);
});
}
})(Zepto);
// (function($){
// var cache = [], timeout;
//
// $.fn.remove = function(){
// return this.each(function(){
// if(this.tagName == 'IMG'){
// cache.push(this);
// this.src = 'data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=';
// if (timeout) clearTimeout(timeout);
// timeout = setTimeout(function(){ cache = [] }, 60000);
// }
// this.parentNode.removeChild(this);
// });
// }
// })(Zepto);

0 comments on commit d84eab6

Please sign in to comment.