ddr-ecma5 lets you to write ECMAScript 5 code and run it on older environments like IE6 (I know - it must die anyway) or Firefox < 4. It works also perfectly outside the browser
- like Rhino, SpiderMonkey, etc.
-
In browser applications just add the library to your web page and enjoy
<script type="text/javascript" src="ddr-ecma5.js"></script>
-
In Rhino/SpiderMonkey environments use
load
function:load('ddr-ecma5.js');
-
Node.JS - do not bother to load the library to your node projects - V8 supports ECMAScript 5 by itself.
If you are curious which functionality of ECMAScript 5 is currently supported by your browser
open test/ddr-ecma5-features-test.html
file. Another test file - ddr-ecma5-test.html
- executes
a test of the library itself. All tests are using QUnit framework.
Yes it is! The library development started at the beginning of 2010 and each feature of it has been
properly tested. Version 1.2 of the library contains all ECMAScript 5 methods which can be implemented
with ECMAScript 3 features - means no new methods will be added.
Currently the author focuses only on the stability and performance of the library.
ddr-ecma5 is used by many developers in their private and commercial projects.
Not all features of ECMAScript 5 can be implemented with ECMAScript 3. An example can be freeze feature or the strict mode. However most of extensions, like new methods of Array, String or Function are provided by the library.
The table below illustrates in which version of a browser the particular feature of ECMAScript 5 has been introduced. As you can see in most of the cases only the latest versions of the browsers (like IE9, FF4, SF5) are supporting the ECMAScript 5 standard. You can use ddr-ecma5 library to keep the backward compatibility with older browsers without resigning from ECMAScript 5 features.
Feature | ddr-ecma5 | Chrome | Firefox | Safari | Opera | IE | Rhino |
---|---|---|---|---|---|---|---|
Function.prototype.bind | 1.0 | 7.0 | 4.0 | - | - | 9.0 | 1.7R3 |
Object.keys | 1.0 | 5.0 | 4.0 | 5.0 | - | 9.0 | 1.7R3 |
Object.getPrototypeOf | 1.0 1 | 5.0 | 4.0 | 5.0 | - | 9.0 | 1.7R3 |
Object.create | 1.0 1 | 5.0 | 4.0 | 5.0 | - | 9.0 | 1.7R3 |
Object.defineProperty | 1.2 1 | 5.0 | 4.0 | 5.0 | - | 8.0 3 | 1.7R3 |
Object.defineProperties | 1.2 1 | 5.0 | 4.0 | 5.0 | - | 9.0 | 1.7R3 |
Object.getOwnPropertyDescriptor | 1.2 | 5.0 | 4.0 | 5.0 | - | 8.0 | 1.7R3 |
Object.getOwnPropertyNames | 1.2 | 5.0 | 4.0 | 5.0 | - | 9.0 | 1.7R3 |
Object.preventExtensions | - 2 | 6.0 | 4.0 | - | - | 9.0 | 1.7R3 |
Object.seal | - 2 | 6.0 | 4.0 | - | - | 9.0 | 1.7R3 |
Object.freeze | - 2 | 6.0 | 4.0 | - | - | 9.0 | 1.7R3 |
Object.isExtensible | 1.1 | 6.0 | 4.0 | - | - | 9.0 | 1.7R3 |
Object.isSealed | 1.1 | 6.0 | 4.0 | - | - | 9.0 | 1.7R3 |
Object.isFrozen | 1.1 | 6.0 | 4.0 | - | - | 9.0 | 1.7R3 |
String.prototype.trim | 1.0 | 5.0 | 3.5 | 5.0 | 10.5 | 9.0 | 1.7R3 |
Array.isArray | 1.0.1 | 5.0 | 4.0 | 5.0 | 10.5 | 9.0 | 1.7R3 |
Array.prototype.indexOf | 1.0 | 5.0 | 3.0 | 3.2 | 10.1 | 9.0 | 1.6R3 |
Array.prototype.lastIndexOf | 1.0 | 5.0 | 3.0 | 3.2 | 10.1 | 9.0 | 1.6R3 |
Array.prototype.every | 1.0 | 5.0 | 3.0 | 3.2 | 10.1 | 9.0 | 1.6R3 |
Array.prototype.some | 1.0 | 5.0 | 3.0 | 3.2 | 10.1 | 9.0 | 1.6R3 |
Array.prototype.forEach | 1.0 | 5.0 | 3.0 | 3.2 | 10.1 | 9.0 | 1.6R3 |
Array.prototype.map | 1.0 | 5.0 | 3.0 | 3.2 | 10.1 | 9.0 | 1.6R3 |
Array.prototype.filter | 1.0 | 5.0 | 3.0 | 3.2 | 10.1 | 9.0 | 1.6R3 |
Array.prototype.reduce | 1.0 | 5.0 | 3.0 | 4.0 | 10.5 | 9.0 | 1.7R3 |
Array.prototype.reduceRight | 1.0 | 5.0 | 3.0 | 4.0 | 10.5 | 9.0 | 1.7R3 |
Date.prototype.toISOString | 1.0 | 5.0 | 3.5 | 4.0 | 10.5 | 9.0 | 1.7R3 |
Date.prototype.toJSON | 1.0 | 5.0 | 3.5 | 4.0 | ? | 8.0 | 1.7R3 |
Date.now | 1.0 | 5.0 | 3.0 | 4.0 | 10.5 | 9.0 | 1.6R1 |
Strict mode | - 2 | - | 4.0 | - | - | - | - |
Notes
1 - limited functionality in comparison to ECMAScript 5 specification
2 - impossible to implement this feature with ECMAScript 3 functionality
3 - on IE8 Object.defineProperty works only with DOM objects.