google / traceur-compiler

Traceur is a JavaScript.next-to-JavaScript-of-today compiler
Apache License 2.0
8.17k stars 581 forks source link

Older version of WebKit does not have Function.prototype.bind defined in ECMAScript 5.1... #1945

Closed oksurf closed 9 years ago

oksurf commented 9 years ago

Traceur is supposed to translate to ECMAScript 5. Function.prototype.bind is only standard in "ECMAScript 5.1 (ECMA-262) The definition of 'Function.prototype.bind' in that specification."

I'm able to use a polyfill but if Traceur is truly generating ECMAScript 5 then it should not count on this being available in the browser. I'm using a custom "corporate" Qt version of Webkit...

arv commented 9 years ago

Not true. bind is part of ES5. 5.1 is just an errata of 5.

Try this: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind#Polyfill

oksurf commented 9 years ago

Yes the polyfill works, just thought you might add that to traceur in case it is not defined, would save hassle for other ECMAScript5 browsers that did not implement the errata 5.1?

UltCombo commented 9 years ago

Erratas do not add any new functionality. @arv has already said it, Function#bind is part of ES5, not ES5.1.