Monthly Archives: December 2006

Function.prototype.apply revisited

You can learn a lot about JavaScript by implementing your own version of apply. In this post I present my own implementation with plenty of notes to highlight and explain the hidden complexity.

Posted in JavaScript

Fixing Firebug’s Style Tab

Some users upgrading to the new Firebug Beta are having problems using the Style tab. There is a short three-step procedure for fixing the problem, described here.

Posted in Browsers, CSS

Iterating over sparse arrays

This is a quick tip for iterating over arrays and other objects with a length property. It’s particularly suitable for sparse arrays, without having to worry whether any methods have been added to the prototype chain.

Posted in JavaScript

Array push and pop: a complete embarrassment for JavaScript

Most JavaScript libraries include trivial implementations of Array’s push and pop methods to provide support for older browsers. With no exaggeration, every implementation is flawed. While this is quite damming, I’ve discovered something worse: not one browser implements push and pop correctly. Each browser has its own bugs: Internet Explorer’s methods can’t be reused; Safari has type-conversion issues; Firefox & Opera don’t truncate Arrays properly.

Seven years after the publication of the ECMAScript Language Specification, shouldn’t we expect a little more? In this article, I’ll document the current problems, and show how to write implementations that conform precisely to the language spec’.

Posted in Browsers, JavaScript