Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In Firebug, $ == jQuery returns false, only sometimes

Okay, I have this weird problem in Firefox. I type in Firebug's console

$ == jQuery

Sometime it displays true, and sometimes false. The file is just an empty HTML document with one script tag including jQuery. I refresh the page, click "Run" in the console, and again, occasionally it returns true, occasionally false.

On the occasions where it returns false, $.toString() gives

function anonymous() {
    return window.console.notifyFirebug(arguments, "$", "firebugExecuteCommand");
}

Now here's the weird thing. When $ == jQuery gives false using Firebug's console, if I go to the address bar and type javascript:alert($ == jQuery);, it alerts true!

Does anyone have any idea what's going on here? It's (occasionally) messing up my debugging.

like image 571
Nick Avatar asked Aug 29 '10 03:08

Nick


1 Answers

There's a native function defined by firebug that assigns $ to getElementById. I don't think you can resolve this "bug" without upgrading to a newer version of Firebug which potentially eliminated the issue, or manually assign $ = jQuery.

It's probably come as a result of possibly jQuery already being cached and the Firebug $ overriding it as it fires too fast, or vice versa.. just some weird bug in regards to speed of assignment + caching.

like image 112
meder omuraliev Avatar answered Oct 12 '22 16:10

meder omuraliev