Skip to content

ddrcode/ddr-ecma5

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ddr-ecma5

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.

Installation

  1. In browser applications just add the library to your web page and enjoy

    <script type="text/javascript" src="ddr-ecma5.js"></script>
  2. In Rhino/SpiderMonkey environments use load function:

    load('ddr-ecma5.js');
  3. 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 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.

Functionality and compatibility

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-ecma5ChromeFirefoxSafariOperaIERhino
Function.prototype.bind 1.07.04.0--9.01.7R3
Object.keys 1.05.04.05.0-9.01.7R3
Object.getPrototypeOf 1.0 15.04.05.0-9.01.7R3
Object.create 1.0 15.04.05.0-9.01.7R3
Object.defineProperty 1.2 15.04.05.0-8.0 31.7R3
Object.defineProperties 1.2 15.04.05.0-9.01.7R3
Object.getOwnPropertyDescriptor 1.25.04.05.0-8.01.7R3
Object.getOwnPropertyNames 1.25.04.05.0-9.01.7R3
Object.preventExtensions - 26.04.0--9.01.7R3
Object.seal - 26.04.0--9.01.7R3
Object.freeze - 26.04.0--9.01.7R3
Object.isExtensible 1.16.04.0--9.01.7R3
Object.isSealed 1.16.04.0--9.01.7R3
Object.isFrozen 1.16.04.0--9.01.7R3
String.prototype.trim 1.05.03.55.010.59.01.7R3
Array.isArray 1.0.15.04.05.010.59.01.7R3
Array.prototype.indexOf 1.05.03.03.210.19.01.6R3
Array.prototype.lastIndexOf 1.05.03.03.210.19.01.6R3
Array.prototype.every 1.05.03.03.210.19.01.6R3
Array.prototype.some 1.05.03.03.210.19.01.6R3
Array.prototype.forEach 1.05.03.03.210.19.01.6R3
Array.prototype.map 1.05.03.03.210.19.01.6R3
Array.prototype.filter 1.05.03.03.210.19.01.6R3
Array.prototype.reduce 1.05.03.04.010.59.01.7R3
Array.prototype.reduceRight 1.05.03.04.010.59.01.7R3
Date.prototype.toISOString 1.05.03.54.010.59.01.7R3
Date.prototype.toJSON 1.05.03.54.0?8.01.7R3
Date.now 1.05.03.04.010.59.01.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.

About

ECMAScript 5 functionality for ECMAScript 3 interpreters

Resources

License

Stars

Watchers

Forks

Packages

No packages published