Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8011718

A function can't be bound twice

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 8
    • 8
    • core-libs
    • b93
    • Verified

      Doing a first bind, then a second with an argument, it fails with:Exception in thread "main" java.lang.IllegalArgumentException: no argument type to append

      If no argument is passed, the previously bound this is still the context when doing the second call.

      var obj = {
          hello:"From obj",
      };
      var obj2 = {
          hello:"From obj2",
      };

      function doit(cb){
          cb();
          var cb2 = cb.bind( obj2, "This one is not acccepted");
          cb2();
      }

      doit(function(){
              print(this.hello);
          }.bind(obj));

            attila Attila Szegedi
            jfdenise Jean-Francois Denise (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: