开发者

Is it possible to undefine a javascript method?

开发者 https://www.devze.com 2023-03-19 16:06 出处:网络
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 functi

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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号