Categories
main

Backward compatibility dillema

Open your favorite browser. Type

javascript:for(var i in null) {}

and check if this will throw an error.
In fact, it should, but I tested Konqueror, Opera, Firefox, Shimono tested IE6 and Shaver tested Safari – all of them passed this.

To prove that this behavior is not proper, head to ECMA standard 262, and take a look at:
Point 12.6.3, step 3:

12.6.4 The for-in Statement
The production IterationStatement : for ( LeftHandSideExpression in Expression ) Statement is
evaluated as follows:
1. Evaluate the Expression.
2. Call GetValue(Result(1)).
3. Call ToObject(Result(2)).
4. Let V = empty.

Point 9.9:

9.9 ToObject

The operator ToObject converts its argument to a value of type Object according to the following table:
Input Type Result
Undefined Throw a TypeError exception.
Null Throw a TypeError exception.
Boolean Create a new Boolean object whose [[value]] property is set to the value of the boolean. See 15.6 for a description of Boolean objects.
Number Create a new Number object whose [[value]] property is set to the value of the number. See 15.7 for a description of Number objects.
String Create a new String object whose [[value]] property is set to the value of the string. See 15.5 for a description of String objects.
Object The result is the input argument (no conversion).

So we should throw an error. The question is. What sites will we break? Shaver asked me to find some sites that will be broken, but it’s not that easy. So if you know about any site that might do for in loop on undefined element, please, let me know.

Categories
main

Opera will be finally free?

That’s a great news! Opera Watch claims that Opera S.A. will announce alternative buisness model for Opera browser soon. And, as for me, there is only one alternative – freeware.

There are two ways for Opera. It can either became “exclusive” browser as I mentioned in some previous post, or go freeware and compete Firefox, IE and (soon) Konqueror. It seems that Opera will be free. No, not free as in Opera’s current marketing rubbish “free, but…” – a really, 100% free browser.

Is this good? It’s a motivator for Mozilla team for sure. It’s also a fall of a next myth. Once Opera is free and identifies as Opera, there wont be any more excuses for much lower market share. If they will not be able to gather more market share (remember their “awesome” 8.0 long awaited marketing campaign?) – they will have to start looking for issues inside their software, not outside.

Also, what about moving to open source? Humm? Temptating? 😉