1

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.

4
  • Which function and how is it called? Is it a global function or is it in the "moo namespace"? Commented Jul 9, 2011 at 22:32
  • What is the specific conflict because it depends upon what moo functionality it is that is conflicting? Different types of things would take different methods to remove. I don't think there is a general purpose answer without knowing the exact item. For example, you'd have to do something different to replace an override the moo sets vs. just get rid of some moo function. Commented Jul 9, 2011 at 22:41
  • What do you mean by permanently remove? Scripts are local to a page, right? So if the function you want to remove in moo is called f, then put in a script tag with the statement moo.f = undefined. Any calls of the form moo.f() would break on that particular page, of course, but I think the "rest of the site" would be okay. Commented Jul 10, 2011 at 3:38
  • The problem child is the create method in the following code in moo tools 1.2.x (and upgrading isn't an option) I need to un define create as this conflicts with some things in FB.ui in facebook's javascript API. You can find the exact function definitions in mootools.net/download/get/mootools-1.2.5-core-nc.js at line 566. That's what I need to undefine. Function.implement({ create: function(options){ Commented Jul 10, 2011 at 18:22

3 Answers 3

4
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
Sign up to request clarification or add additional context in comments.

Comments

2

Maybe overriding the function would be the solution?

Overriding a JavaScript function while referencing the original

1 Comment

In many cases this would work. For my specific instance I need it to be gone as removing the function altogether fixes my conflict.
0

MooTools version 1.4.3 solves this issue - you may download it from Download MooTools 1.4.3

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.