最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Are there still ECMAScript 3 implementation differences in major browsers? - Stack Overflow

programmeradmin1浏览0评论

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)?

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)?

Share Improve this question edited Sep 9, 2010 at 20:37 AlfaTeK asked Sep 9, 2010 at 17:59 AlfaTeKAlfaTeK 7,78514 gold badges53 silver badges92 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 8

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-.

Remended article:

  • JScript deviations from ES3pdf
发布评论

评论列表(0)

  1. 暂无评论