
ddr-ecma5
Introduction
ddr-ecma5 is a JavaScript library which brings the ECMAScript 5 extensions to any browser. It includes set of ECMAScript 5 methods to Object
, Array
, String
, Date
and Function
objects which are possible to be implemented with ECMAScript 3 features.
The goal of ddr-ecma5 library is to promote ECMAScript 5 features and to bring them to the environments of current browsers. Thanks to the library JavaScript developers can write their programs using new standards and be sure that their programs will run properly also on older browsers. The library works also properly outside browsers (Rhino, SpiderMonkey, etc.).
The library is properly unit tested with QUnit.
Project author: David de Rosier
ECMAScript 5 features in different environments
The table below shows when particular features of ECMAScript 5 were introduced to different environments.
| Feature | ddr-ecma5 | Chrome | Firefox | Safari | Opera | IE | Konqueror 4.3.2 | Rhino |
|:------------|:--------------|:-----------|:------------|:-----------|:----------|:-------|:--------------------|:----------|
| Function.prototype.bind
| 1.0 | 7 | 4.0 | - | - | 9 | - | 1.7R3 |
| Object.keys
| 1.0 | 5 | 4.0 | 5.0 | - | 9 | - | 1.7R3 |
| Object.getPrototypeOf
| 1.01 | 5 | 4.0 | 5.0 | - | 9 | - | 1.7R3 |
| Object.create
| 1.01 | 5 | 4.0 | 5.0 | - | 9 | - | 1.7R3 |
| Object.defineProperty
| 1.21 | 5 | 4.0 | 5.0 | - | 83 | ? | 1.7R3 |
| Object.defineProperties
| 1.21 | 5 | 4.0 | 5.0 | - | 9 | ? | 1.7R3 |
| Object.getOwnPropertyDescriptor
| 1.2 | 5 | 4.0 | 5.0 | - | 8 | ? | 1.7R3 |
| Object.getOwnPropertyNames
| 1.2 | 5 | 4.0 | 5.0 | - | 9 | ? | 1.7R3 |
| Object.preventExtensions
| - 2 | 6 | 4.0 | - | - | 9 | ? | 1.7R3 |
| Object.isExtensible
| 1.1 | 6 | 4.0 | - | - | 9 | ? | 1.7R3 |
| Object.seal
| - 2 | 6 | 4.0 | - | - | 9 | ? | 1.7R3 |
| Object.isSealed
| 1.1 | 6 | 4.0 | - | - | 9 | ? | 1.7R3 |
| Object.freeze
| - 2 | 6 | 4.0 | - | - | 9 | ? | 1.7R3 |
| Object.isFrozen
| 1.1 | 6 | 4.0 | - | - | 9 | ? | 1.7R3 |
| String.prototype.trim
| 1.0 | 5 | 3.5 | 5.0 | 10.5 | 9 | - | 1.7R3 |
| Array.isArray
|1.0.1 | 5 | 4.0 | 5.0 | 10.5 | 9 | ? | 1.7R3 |
| Array.prototype.indexOf
| 1.0 | 5 | 3.0 | 3.2 | 10.1 | 9 | + | 1.6R3 |
| Array.prototype.lastIndexOf
| 1.0 | 5 | 3.0 | 3.2 | 10.1 | 9 | + | 1.6R3 |
| Array.prototype.every
| 1.0 | 5 | 3.0 | 3.2 | 10.1 | 9 | + | 1.6R3 |
| Array.prototype.some
| 1.0 | 5 | 3.0 | 3.2 | 10.1 | 9 | + | 1.6R3 |
| Array.prototype.forEach
| 1.0 | 5 | 3.0 | 3.2 | 10.1 | 9 | + | 1.6R3 |
| Array.prototype.map
| 1.0 | 5 | 3.0 | 3.2 | 10.1 | 9 | + | 1.6R3 |
| Array.prototype.filter
| 1.0 | 5 | 3.0 | 3.2 | 10.1 | 9 | + | 1.6R3 |
| Array.prototype.reduce
| 1.0 | 5 | 3.0 | 4.0 | 10.5 | 9 | + | 1.7R3 |
| Array.prototype.reduceRight
| 1.0 | 5 | 3.0 | 4.0 | 10.5 | 9 | + | 1.7R3 |
| Date.prototype.toISOString
| 1.0 | 5 | 3.5 | 4.0 | 10.5 | 9 | - | 1.7R3 |
| Date.prototype.toJSON
| 1.0 | 5 | 3.5 | 4.0 | ? | 8 | - | 1.7R3 |
| Date.now
| 1.0 | 5 | 3.0 | 4.0 | 10.5 | 9 | + | 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
Full ECMAScript 5 comparison table to be found here
Installation
On the web - just add the library to your webpage and enjoy ```
```
In Rhino/SpiderMonkey environments use the 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
Testing
If you are curious which functionality of ECMAScript 5 is currently supported by your browser then 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.
Is it stable?
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.
Project Information
- License: MIT License
- 16 stars
- svn-based source control
Labels:
ECMA5
JavaScript
prototype
ECMAScript5