Assorted IE8 polyfills: forEach, trim, placeholders

I ended up using all of the following during recent development of weathersupermarket 2.0 and another site. Array.prototype.forEach() implemented using a for loop and fn.apply if (typeof Array.prototype.forEach !== ‘function’) { Array.prototype.forEach = function(callback, context) { for (var i = 0; i < this.length; i++) { callback.apply(context, [ this[i], i, this ]); } }; }… Continue reading Assorted IE8 polyfills: forEach, trim, placeholders