Giter VIP home page Giter VIP logo

compat-table's Introduction

ECMAScript compatibility tables

Gitter

Bitdeli Badge

Editing the tests

Edit the data-es5.js, data-es6.js, data-esnext.js, or data-non-standard.js files to adjust the tests and their recorded browser results. Run node build.js to build the HTML files from these JavaScript sources.

The ES6 tests themselves should be written in pure ES3, except for the sole ES6 feature being tested (as well as any ES5 features strictly required to use the ES6 feature). ES Next tests may use any ES5 features that they wish, and only the ES6 features strictly required to use the ES Next feature.

The test code is placed in multi-line comments (as in this hack), so that Node.js can parse the data scripts without throwing syntax errors when encountering features it does not support. The build.js script will wrap the code in an eval call inside a try, so the tests themselves do not need to catch errors that non-supporting platforms may throw.

Most tests have a significance rating, which affects how a platform's total support percentage is calculated. A test rated "large" (representing a landmark, transformative feature) is worth 1, one rated "medium" (representing a significant feature that's less universally useful, or is primarily connected to another feature) is worth 0.5, and one rated "small" (representing a useful but subtle improvement from the previous spec) is worth 0.25. "tiny" (0.125) should be reserved for very meager changes (such as changes to an existing function's parameters or side-effects) that nonetheless don't fall under the category of another feature.

In order to test compilers

Run npm install to install the compilers under test (and remember to npm update them frequently). Then run node build.js compilers to create compiler test pages under es6/compilers. Currently only the ES6 tests produce compiler test pages. Open the compilers' HTML files in a browser with close to zero native ES6 support, such as Internet Explorer 9 (although its lack of support for strict mode will cause some tests to fail), Opera 12, or Safari 5.1 (bearing in mind their native support for TypedArrays, __proto__ and such).

Note that some tests cannot be compiled correctly, as they rely on runtime eval() results to ensure that, for instance, certain syntactic constructs are syntax errors. These will fail on the compiler test pages. Support for those features should be divined manually.

In order to test Node.js

After installing dependencies using npm install, first compile a fresh ES6 HTML file using node build.js.

Then, run node ., where node is the executable you wish to test, along with any desired flags (such as --es-staging). The results should be printed in colour in stdout: green results indicate correct support, cyan results indicate support that incorrectly requires strict mode, and red indicates no support.

Note that this script is currently hard-coded to only display ES6 results.

compat-table's People

Contributors

afmenez avatar chicoxyzzy avatar claudepache avatar constellation avatar danielrosenwasser avatar dstorey avatar evilpie avatar fbender avatar jirkamarsik avatar jlhwung avatar jridgewell avatar kangax avatar keithamus avatar ktamas avatar ljharb avatar mgol avatar mkellner avatar natorion avatar nicolo-ribaudo avatar rbuckton avatar rwaldron avatar shvaikalesh avatar skalman avatar svaarala avatar teppeis avatar webbedspace avatar wetinee avatar wirthi avatar yaffle avatar zloirock avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

compat-table's Issues

Positioning Issue in Opera

The Flattr button and author attribution text in the banner are partially hidden in Opera because it is mispositioned.

Usability enhancements

To improve readability of the list, I propose to:

  • Drop/hide obsolete browsers, e. g. Firefox <17 (Fx 17 is ESR, so it will be around for at least a few months), Chrome <21 (usage numbers are near-zero or actually zero).
  • Make columns hideable (so one can only display the columns he is interested in). This can be achieved with a small JS (which I'm happy to provide, but it may take some time before I can get to it).
  • Highlight current row (and, if possible, column) on mouseover.
  • A way to unfocus browser, by clicking on the focused browser again
  • Separate browser+versions into 2 headers
  • Fixed header
  • Replace bottom notes with inline tooltips (for convenience)
  • Expand subtests by clicking on entire cell (except link) not just "down" arrow

node harmony values needs to be fixed.

I'm not sure, which node version is been targeted in the table, but the below mentioned works fine for v0.11.7

$ node -v
v0.11.7

# Note : --harmony enables all the flags except type_of in V8, but for node we need to do the below.
$ node --use-strict $(node --v8-options | grep harm | awk '{print $1}'| xargs) # enabling all harmony flags

# let keyword works.
> eval('(function () { let foobarbaz2 = 123; return foobarbaz2 == 123; }())')
true

# Iterators and for-of loop for them works fine.
function *Counter(){
  var n = 0;
  while(1<2) {
    yield n;
    ++n;
  }
}

var CountIter = new Counter();

for(let value of CountIter) {
  console.log(value);
} 

# Generator yield works fine.
> eval('(function* () { yield 5; }())');
{}

# Sets works fine.
> var set = new Set();
> set.add(123); 
> set.has(123) && set.size === 1
> true

# Proxies works fine, Proxy.create() is present, not the latest spec though.
> Proxy
{}

# Block level function definition works 
>> eval('{function f(){}} typeof f == "undefined"');
true

# Some of the String functions 
> String.prototype.repeat
[Function: repeat]
> String.prototype.startsWith
[Function: startsWith]
> String.prototype.endsWith
[Function: endsWith]

# Array functions 
> Array.prototype.find
[Function: find]
> Array.prototype.findIndex
[Function: findIndex]

# Finally Math
 > Math.imul
[Function: imul]

data-es6.js#L2567 need a var as it's in strict mode?

L653 needs a fix for node?

Happy to send a PR :)

Outline Problem in Opera

The outline around the "Current Browser" column is being displayed over the info window that is displayed when you hover over (c)

easier way to edit "tables"

What is the easiest & fastest way to add a column (eg new browser version) for your tables please? I was about to add FF14 for you, & I looked at it, & said, "Table layouts = cool, not cool I have to hand- edit a new column." What tools do you use/recommend, or can this be automated please? New browser versions are added every few months now.

WeakSet

I think only V8 with --harmony supports WeakSet but it would be good to have it in the table for completeness sake.

Consider adding an ES5 identifier test

E.g. a\u200c\u200d is a valid identifier as per ES5, but not all browsers/engines support it (yet).

This can easily be tested as follows:

var supportsZeroWidth = (function() {
    try {
        Function('var a\u200c\u200d');
        return true;
    } catch(e) { }
}());

supportsZeroWidth will be true if ZWJ and ZWNJ characters are supported in IdentifierPart, else undefined (which is falsy).

ES6 Pragmas test?

I'm not sure I understand the ES6 "pragmas" test, as there is nothing in ES6 that matches:

use strict;

(not to be confused with the string version of the same words)

ES6 Iterator support

The ES6 table says that Iterators aren't supported in any version of Firefox, however my own testing in Firefox 23 indicates that they are supported.

Chrome 22 doesn’t seem to support callable regex

The “CH 7-10” column says callable regex is supported, but I’m getting a “NO” in the “this browser” column when using Chrome Canary v22.0.1187.0. I’m not sure if this is a typo, a false positive in the test, or a regression in Chrome. I haven’t tested other Chrome versions.

Colorblind friendly

I know this is probably an odd request, but I am red/green color blind and I am not able to see the difference in the table, beyond the yes/no. Is there a possibility for colorblind (red/green) friendly colors?

spread test in es6 seems wrong

Here's the spread(...) test:

test((function () {
          try {
            return eval('(function(args) { return typeof args !== "undefined"; })()');
          } catch(error) {
            return false;
          }
        })())

Maybe you meant eval('(function(args) { return typeof args !== "undefined"; })(...[1])'); ?

Open source license

First off, super useful data source!

I would like to use this data in an automated fashion in an node.js module, but concerned about licensing.

I wasn't sure if you intended to put a license on it, but it would be awesome if you released it as open source under something like zlib or MIT.

Cheers!

Objects with `iterator` property should not be iterable

Although it's not finalized how users can create iterable objects, it's definitely not going to be through a simple iterator property. Right now you're just testing against Firefox's nonstandard implementation.

I can't really see a good test for this, however, given that TC39 hasn't decided exactly how it will work. Probably via a symbol that you import from a standard module, but not clear.

Arrow functions!

Suggested test:

try {
  eval('var a = () => 5;');
} catch (e) {
  return false;
}
return true;

Delete master branch

As gh-pages is the default branch, and master has not been updated since … ever, I think you can remove master. It's a bit confusing to have them both around, with one being totally out-of-date and unneeded.

Sort by most-implemented

Perhaps add a count next to each feature of how many of the listed browsers have implemented the feature, and then have a checkbox to sort by most-implemented features?

Add Android browsers to compat tables

I would find it very helpful to see Android browsers at a glance in this table as well. If anyone knows of a existing resource, I’ll happily contribute a PR!

Module test

The module test looks wrong, it's the same as the rest parameters test.

Update traceur

Traceur supports a lot of the features the table states it doesn't. Especially if you enable the experimental features. Things like destruction for instance is implemented already, and experimental support for let and const is in place (though it might kill your performance).

Some additional let/const tests

Here are some additional semantics you can test for let and const. All of them should only be run if the basic tests succeed (i.e. const x = 5; and let x = 5; do not produce errors when evaled).

const must have an initializer

try {
  eval('const x;');
} catch (e) {
  return e instanceof SyntaxError;
}
return false;

Cannot occur twice with the same identifier within a block

try {
  eval('let x; let x;');
} catch (e) {
  return e instanceof SyntaxError;
}
return false;
try {
  eval('const x = 5; const x = 5;');
} catch (e) {
  return e instanceof SyntaxError;
}
return false;

Temporal dead zone (use before declaration)

try {
  eval('x; const x = 5;');
} catch (e) {
  return e instanceof ReferenceError;
}
return false;
try {
  eval('x; let x;');
} catch (e) {
  return e instanceof ReferenceError;
}
return false;

Temporal dead zone still works with shadowing

try {
  eval('const x = 2; { x; const x = 5; }');
} catch (e) {
  return e instanceof ReferenceError;
}
return false;
try {
  eval('let x; { x; let x; }');
} catch (e) {
  return e instanceof ReferenceError;
}
return false;

Fresh per-loop iteration

var a = [];
for (let i = 0; i < 3; ++i) {
  a[i] = function () { return i; };
}

return typeof i === "undefined" && a[1]() === 1;

Proxy test should test for direct proxies

In particular, testing for Proxy.create and Proxy.createFunction will product false negatives in environments which only implement direct proxies, and not the nonstandard spec.

Suggested test:

typeof Proxy === "function" && new Proxy({}, { get: function () { return 5; }).foo === 5;

apparently Firefox fails the first part of this.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.