B
Brownie Guy
Today while researching a bug I found this script:
var Event = {
add: function() {
if (window.attachEvent) {
return function(el, type, fn) {
var f = function() { fn.call(Dom.get(el), window.event); };
Dom.get(el).attachEvent('on' + type, f);
};
}
}()
};
Its the () at the end of the function definition that leaves me
scratching my head. I looked around but I wasn't able to learn the
name of this feature and thus unable to research it farther. Can
someone point me in the right direction or explain it.
Much Appreciated
Travis
var Event = {
add: function() {
if (window.attachEvent) {
return function(el, type, fn) {
var f = function() { fn.call(Dom.get(el), window.event); };
Dom.get(el).attachEvent('on' + type, f);
};
}
}()
};
Its the () at the end of the function definition that leaves me
scratching my head. I looked around but I wasn't able to learn the
name of this feature and thus unable to research it farther. Can
someone point me in the right direction or explain it.
Much Appreciated
Travis