D
danf
Can anyone tell me what the difference is between these two protoype
methods?
They are extensions of Javascript's Function class.
Is bindAsEventListener just used to be compatible with IE's Event
model?
I'm thinking the only difference between the 2 methods is that
bindAsEventListener passes the event into the function.
I want to know how I can practically apply these.
METHODS FROM prototype-1.5.0_rc1.js
Function.prototype.bind = function() {
var __method = this, args = $A(arguments), object = args.shift();
return function() {
return __method.apply(object, args.concat($A(arguments)));
}
}
Function.prototype.bindAsEventListener = function(object) {
var __method = this, args = $A(arguments), object = args.shift();
return function(event) {
return __method.apply(object, [( event ||
window.event)].concat(args).concat($A(arguments)));
}
}
methods?
They are extensions of Javascript's Function class.
Is bindAsEventListener just used to be compatible with IE's Event
model?
I'm thinking the only difference between the 2 methods is that
bindAsEventListener passes the event into the function.
I want to know how I can practically apply these.
METHODS FROM prototype-1.5.0_rc1.js
Function.prototype.bind = function() {
var __method = this, args = $A(arguments), object = args.shift();
return function() {
return __method.apply(object, args.concat($A(arguments)));
}
}
Function.prototype.bindAsEventListener = function(object) {
var __method = this, args = $A(arguments), object = args.shift();
return function(event) {
return __method.apply(object, [( event ||
window.event)].concat(args).concat($A(arguments)));
}
}