This project is archived and is in readonly mode.

#822 ✓ resolved
Sanford Whiteman

Resolve future issues with the ES5 Function.prototype.bind method

Reported by Sanford Whiteman | January 4th, 2010 @ 07:56 PM | in 1.3.0 rc2 (closed)

Chrome 3 creates its own function.prototype.bind, which breaks the MooTools bind function as it is does not accept the same arguments.

See Chrome/Application//resources/inspector/base.js:897:

Function.prototype.bind = function(self, var_args) {
if (arguments.length > 1) {

var args = Array.prototype.slice.call(arguments, 1);
args.unshift(this, self);
return goog.bind.apply(null, args);

} else {

return goog.bind(this, self);

} };

It appears that this was fixed in Chrome 4 (they only have the namespaced goog.bind now)... but 4 is still in beta at this time, and Chrome users do not get auto-updated beyond the latest stable version.

Comments and changes to this ticket

  • Sanford Whiteman

    Sanford Whiteman January 5th, 2010 @ 08:07 AM

    This seems to be related to Chrome themes. It does not present in an installation with no themes, as far as I have seen. I am trying to get a 100% repro case, but have gotten 4 different machines to break like this by installing themes.

  • Sebastian Markbåge

    Sebastian Markbåge January 5th, 2010 @ 12:27 PM

    • Milestone changed from 2.0 to 1.3.0 rc2
    • State changed from “new” to “open”

    As far as I know it's only a few middle versions of Chrome that actually implemented it. They should be updated automatically. So it "should" fix it self. However, this is part of the new ECMAScript 5 standard. So it will likely show up in more browsers in the future.

    We're aware of this issue and it will be need to be addressed in the next version of MooTools.

  • Sanford Whiteman

    Sanford Whiteman January 6th, 2010 @ 01:55 AM

    This was on latest stable 3.0.195.38, but can understand not bothering with it on account of how many people let the auto-update run. Thanks!

  • fakedarren

    fakedarren January 7th, 2010 @ 10:53 PM

    • State changed from “open” to “resolved”

    As Chrome 4 is now out in the wild, marking as closed, but will keep an eye out for this. Will add test in specs.

  • fakedarren

    fakedarren January 7th, 2010 @ 11:17 PM

    • State changed from “resolved” to “open”
    • Assigned user set to “Valerio”

    sebmarkbage made some valid points....

  • nuxodin
  • Christoph Pojer

    Christoph Pojer May 3rd, 2010 @ 08:46 PM

    • State changed from “open” to “invalid”
  • Valerio

    Valerio May 3rd, 2010 @ 08:56 PM

    • Milestone changed from 1.3.0 rc2 to 2.0
    • State changed from “invalid” to “open”
  • fakedarren

    fakedarren May 3rd, 2010 @ 09:12 PM

    Can we change the title of this ticket? The title is misleading. The problem is very relevant however.

  • Christoph Pojer

    Christoph Pojer May 3rd, 2010 @ 09:14 PM

    • Title changed from “Google Chrome 3 breaks Function.prototype.bind due to built-in function of same name” to “Resolve future issues with the ES5 Function.prototype.bind method”

    We have this on the internal todo list anyway, that is why I closed it

  • Geoffrey Sneddon

    Geoffrey Sneddon May 5th, 2010 @ 09:37 AM

    How are we meant to track the bug if it is only on an internal todo list? How is a public bug invalid when it is intended to fix it? I can't watch every library's repository for things that block deployment of new ES5 features.

  • Valerio

    Valerio May 5th, 2010 @ 10:28 AM

    Worry not. The ticket is open.

  • Christoph Pojer

    Christoph Pojer May 5th, 2010 @ 10:40 AM

    I'm sorry, this was obviously my mistake.

  • Erik Corry

    Erik Corry August 23rd, 2010 @ 01:54 PM

    • Milestone order changed from “0” to “0”

    This is beginning to bite people as Google Chrome implements ES5:

    http://code.google.com/p/chromium/issues/detail?id=52842

  • Jeff Walden
  • Christoph Pojer

    Christoph Pojer August 30th, 2010 @ 05:36 PM

    • Milestone changed from 2.0 to 1.3.0 rc2
    • State changed from “open” to “resolved”
    • Assigned user changed from “Valerio” to “Christoph Pojer”
    • Milestone order changed from “797” to “0”

    For MooTools Core 1.3 we are going to adopt the ES5 version of Function.prototype.bind. If you are using the 1.2compat layer, we will overwrite the native bind and use the version of bind you are used to.

    In plugins that are targeted to work on 1.3 both with the compat layer and without it, you should consider changing .bind(this, args) to .pass(args, bind).

    Given that we have always provided .pass to pass an array of arguments we have found this to be a trivial issue for your code. In both MooTools Core and MooTools More (about 20k LOC) we have found only 7 occurrences of bind which would break with the new behavior (that is, 1.3 without compat).

    In addition we are going to provide a bash script that makes the changes in your existing scripts automatically, should you decide to use 1.3 without compat: http://gist.github.com/557192 (work in progress).

    The commit: http://github.com/mootools/mootools-core/commit/aa8d93128af4f98cda2...

    We have provided a bind method for years and we are happy to see it being adopted as a standard. We are fully supporting the ES5 standard and we are glad to see browsers are catching up. Personally, I think our implementation provides the better API, but in the long term its better to make the move now.

    You will find more info in the release blog post of 1.3.

  • Ronda.Nice

    Ronda.Nice September 26th, 2011 @ 02:39 AM

    To install Chrome themes is always not easy and smoothly, I tried also several times before I succeed. I wish something will be improved for the users.
    assurance auto

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Shared Ticket Bins

Referenced by

Pages