Is it possible to undefine a javascript method?
Specifically I am needing to unset a function in mootools for one page that is conflicting with a FB.ui. 开发者_开发问答 But I don't want to do anything drastic such as permanently remove that function as it would break the rest of the site.
var moo = new function()
{
this.fn = function()
{
return 1;
};
};
moo.fn(); // 1
var _moofn = moo.fn; // 'cache pointer'
moo.fn = function(){};
moo.fn(); // nothing
moo.fn = _moofn;
moo.fn(); // 1
Maybe overriding the function would be the solution?
Overriding a JavaScript function while referencing the original
MooTools version 1.4.3 solves this issue - you may download it from Download MooTools 1.4.3
精彩评论