Even if there is still much time until the next major version of the Firefox browser will be released, I want to take a quick look at some of the new features, which have its seeds in the Gecko 1.9 engine.

  1. <element>.clientLeft() and <element>.clientTop() properties
    These properties conatin each HTML elements absolute position on the browser screen. Instead of calculating this values by using <element>.offsetLeft() or <element>.offsetTop() on the element itself and all parent elements recursively, you can now use this browser calculated values — which is a huge performance enhancement.
    I took a small benchmark with a function containing a large amount of different operations (among many calls of offsetTop() and offsetLeft()) and the new properties increased the execution time by 1,57 to 1,83.
  2. Soft hyphens
    This might be interessting for all german-speaking people. It is now possible to use a special kind of hyphen (&shy;) which will be wrapped on line break. From now on you can use the correct notation for coposed words, such as "Warenwirtschaftsystem" instead of the wrong one "Waren Wirtschaft System" just because you have to fear, that the line containing this word will look terrible when using text-align:justify; or breaking your layout.
    Soft hyphen compared with normal once
    Comparision of hyphens
  3. JavaScript 1.8
    Firefox 3 will also include support for JavaScript 1.8, which gives us developers some goodies, like native JSON encoding and decoding (yeah, faster data exchange ;-) ), more array methods and much more. I just want to concentrate on expressions, which allow you to write your code in a lamda-like way:

    function sqr(x) { return x * x; }

    ca be written as

    function sqr(x) return x * x;

    Here is another longer example, taken from John Resig, which creates and fills an array:

    1. Number.prototype.__iterator__ = function() {
    2. for ( let i = 0; i < this; i++ )
    3. yield i;
    4. };
    5. [[ i == j ? 1 : 0 for ( i in 10 ) ] for ( j in 10 )];

It is a bit sad, that most of these great features can not be used (or only with an browser switch) if the end-user is using an older browser wich lacks JavaScript 1.8 support. But on the other hand it is possible to increase your applications performace and eventually these features will be available in other browsers, too.