Supporting feature tests directly

Tab Atkins Jr. jackalmage at
Wed Mar 25 20:23:54 UTC 2015

On Wed, Mar 25, 2015 at 1:17 PM, James Kyle <me at> wrote:
> The reason `@supports` works in CSS is because of the limited language
> feature-set CSS has, but this wouldn't work in JavaScript.

No, it works because most of the time, whether or not something parses
is a sufficient proxy for "this is supported".  This isn't always
adequate - for example, you can't test whether a browser supports APNG
in CSS properties with this - but that's okay.

Similarly, a JS version would let you test for anything where parsing
is a proxy for support, like "function*(){...}" or "()=>{}".  It
wouldn't help you with things where parsing is successful whether the
feature is supported or not.

There's no good way to support those cases that parsing doesn't
address besides direct feature tests, or support tables.  Luckily,
both of these already exist in the ecosystem, so it's okay that we're
not solving them.


More information about the es-discuss mailing list