#278 enhancement
Juriy Zaytsev

#invoke to support host objects' methods

Reported by Juriy Zaytsev | August 13th, 2008 @ 05:32 PM | in 1.6.1

As per http://groups.google.com/group/c... we could change Array#invoke to support host objects' methods - the ones that might not have call or apply:


invoke: function(method) {
    var args = $A(arguments).slice(1);
    return this.map(function(value) {
      return value[method].apply
        ? value[method].apply(value, args)
        : Function.prototype.apply.call(value[method], value, args);
    })
  }

Does this seem reasonable?

Comments and changes to this ticket

Please Login or create a free account to add a new comment.

You can update this ticket by sending an email to from your email client. (help)

Create your profile

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

The Prototype JavaScript library.

Shared Ticket Bins

People watching this ticket