From ea307eafa3b655b612f45a4a279c1010ae633466 Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Wed, 9 Jul 2014 22:58:39 +0200 Subject: [PATCH] es5-shim: Support PhantomJS (has strict mode, but no Function#bind) Follows-up fff9a814f. The es5-shim wasn't being loaded in PhantomJS causing tests to fail due to absence of Function#bind. Change-Id: I84b8ebe382bfc4825accc31a0a5da2fb1717536d --- resources/src/es5-skip.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/resources/src/es5-skip.js b/resources/src/es5-skip.js index d14c64bf11..a4039d8987 100644 --- a/resources/src/es5-skip.js +++ b/resources/src/es5-skip.js @@ -2,14 +2,17 @@ * Skip function for es5-shim module. * * Test for strict mode as a proxy for full ES5 function support (but not syntax) - * Per http://kangax.github.io/compat-table/es5/ this is a reasonable short-cut - * that still allows this to be as short as possible (there are no function "No"s - * for non-"obsolete" real browsers where strict support is available). + * Per http://kangax.github.io/compat-table/es5/ this is a reasonable shortcut + * that still allows this to be as short as possible (there are no browsers we + * support that have strict mode, but lack other features). * - * Note that this will cause IE9 users to get the shim (which should be close to - * a no-op but will increase page payload). + * Do explicitly test for Function#bind because of PhantomJS (which implements + * strict mode, but lacks Function#bind). + * + * IE9 supports all features except strict mode, so loading es5-shim should be close to + * a no-op but does increase page payload). */ return ( function () { 'use strict'; - return !this; + return !this && !!Function.prototype.bind; }() ); -- 2.20.1