Why does FF on OS X play jQuery-UI in a click event handler?

In a webpage using jQuery 1.7.1 and jQuery-UI 1.8.18, if I display $ .ui in the warning field, when the document is ready, I get [object Object]. However, when using Firefox, if I output $ .ui to the click event handler, I get "undefined". In other browsers (latest versions of IE, Chrome and Safari), the result remains [Object] when you click on the link.

Here is my HTML page:

<!doctype html> <html> <head> <title></title> <script src="Scripts/jquery-1.7.1.js" type="text/javascript"></script> <script src="Scripts/jquery-ui-1.8.18.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function () { alert($.ui); // ALERT A $(document).on("click", ".dialogLink", function () { alert($.ui); // ALERT B return false; }); }); </script> </head> <body> <a href="#" class="dialogLink">Click me!</a> </body> </html> 

In this post, I lowered into my simple form another problem that I described here: $ (this) .dialog is not a function . I created a new post for clarity, since the real question is different from the original one, which is now indicated where the problem was.

UPDATE:

IF I replace my alerts with just alert($); I get this result for warning A:

 function (selector, context) { return new jQuery.fn.init(selector, context, rootjQuery); } 

and this one for warning B:

 function (a, b) { return new d.fn.init(a, b, g); } 

This does not make sense to me, although I may not understand well enough that $ is ...

UPDATE 2:

I can only reproduce this problem using Firefox on OS X. On Firefox running on Windows 7, everything is fine.

+1
source share
1 answer

I think you should have an add-in in your Firefox installation on OSX that does not work with the page; in particular, I think it loads a compressed version of jQuery into the page after the page loads, which is strange but explains the behavior you see. Your notification about the $ function clearly shows that it is moving from the uncompressed version ( return new jQuery.fn.init(selector, context, rootjQuery); ) to the compressed version ( return new d.fn.init(a, b, g); ), and reloading jQuery will replace $ with a completely new version, which means jQuery UI additions will disappear from it. For example, something loads compressed jQuery after the page loads, consistent with the symptoms.

The absence of an add-on (or malware, I suppose) while doing this, there is no reason to believe that $ or $.ui will be overridden on the page you posted, and now I tried it on Chrome 17, Firefox 11 and Opera 11 on Linux ( Ubuntu 11.10), as well as IE9, Firefox 5, Safari 5, and Opera 11 on Windows 7. They all work as expected.

I will disable all add-ons and try again. If this happens, I will completely destroy Firefox from the machine and reinstall from scratch.

+4
source

All Articles