On Jan 4, 10:21 am, Joe Athman <[email protected]> wrote:
> Another alternative is to use Prototype's Curry function which let's
> you create new functions with default arguments.
>
> So you could write:
> Event.observe(window, 'mouseup', alert.curry('hi'));

`alert.curry("hi")` won't work in IE, where `window.alert` is not an
instance of Function object and does not "inherit" from
`Function.prototype` (as, pretty much, any other JScript host method).
You can, of course, try to call `curry` from the `Function.prototype`
directly (`Function.prototype.curry.call(window.alert, 1)`), but since
`curry` internally tries to invoke `call` directly on a context
object, this will fail once again. It would work if Prototype.js was
invoking `call` from the `Function.prototype` rather than from the
context object `(Function.prototype.call.call(alert, window, 1))` but
it doesn't and it's not clear if such change is even worth the
trouble.

Never expect anything from host objects.

>
> Joe
> [...]

--
kangax
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to