Are there still ECMAScript 3 implementation differences in major browsers?

Can someone point out the differences in implementation of ECMAScript 3rd edition in today's browsers? (Chrome, Safari, IE8, FF)

Are we safe when using ECMAScript 3 standards (and not the extensions that FF and IE have to JScript and JavaScript)?



Well, of course there are implementation bugs, the most serious that I've had to deal with are on JScript, the Microsoft implementation of the standard, for example:

Identifier of FunctionExpressions should be accessible only in the inner scope of the function itself:

(function foo() {
  alert(typeof foo); // "function"

alert(typeof foo);  // should be "undefined", on IE shows "function"

The bug is present on all current IE versions, it has just been fixed on IE9 Previews.

And actually is even worse, it creates two function objects, for example:

var foo = function bar() {};

if (typeof bar != 'undefined') { // the case of IE
  alert(foo === bar); // false!!!

Another well known JScript bug is the "DontEnum Bug", if an object in its scope chain contains a property that is not enumerable (has the { DontEnum } attribute), if the property is shadowed on other object, it will stay as non-enumerable, for example:

var dontEnumBug = {toString:'foo'}.propertyIsEnumerable('toString');

It will evaluate to false on IE, this causes problems when using the for-in statement, because the properties will not be visited.

JScript is the implementation that has the largest number of problems -although the IE9 implementation is getting really way better-.

Recommended article:


Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.