jQuery warnings in Firefox Error Console

7.1k views Asked by At

All of the sudden, I'm getting a bunch of warnings in the Firefox Error Console... this wasn't happening earlier today, and I haven't made significant changes. The error is just constantly repeating and accumulating about 3-4 times a second:

Warning: reference to undefined property jQuery.ajaxSettings.traditional

and that points to line 5383 of jQuery.js which is the jQuery JavaScript Library v1.4.2 file that I include. This is the only new code I added today:

$(document).ready(function(){
    // search field focus and blur event handlers
    $('#search-field').focus(function() {
        if($(this).hasClass('placeHolder')){
            $(this).val('');
            $(this).removeClass('placeHolder');
            $(this).addClass('search-field');
        }
    });
    $('#search-field').blur(function() {
        if($(this).val() == '') {
            $(this).val('Search');
            $(this).addClass('placeHolder');
        }
    });
});

So when I put this code in its own file separately... I get the following warnings:

Warning: reference to undefined property E.queue

Warning: anonymous function does not always return a value
   Source File: http://localhost/jQueryChat/js/jQuery.js
   Line: 404, Column: 2
   Source Code:
        }, 

Warning: anonymous function does not always return a value
   Source File: http://localhost/jQueryChat/js/jQuery.js
   Line: 416, Column: 23
   Source Code:
        return jQuery.ready(); 

.. and such. So I don't know why this is happening. Any ideas?

UPDATE: I went to about:config for Firefox and turned javascript.options.strict to false and the warnings went away. But I feel like this is not a solution.

Thanks, Hristo

4

There are 4 answers

1
Hristo On BEST ANSWER

I went to about:config for Firefox and turned javascript.options.strict to false and the warnings went away. But I feel like this is not a solution.

http://www.howtocreate.co.uk/strictJSFirefox.html

Hristo

0
German On

jQuery gives low importance to warnings, since they are not critic. You can disable strict warnings in FireFox about:config setting javascript.options.strict to false, or live with them in your Error Console.

Anyway, if you disable them, you may still see some warnings when using jquery-ui-1.7.2.custom.css

1
Robert Hui On

You may also want to restart Firefox and verify the JS bug in another browser, to eliminate any possibility that the JS engine blew up and is giving your erroneous errors.

1
Nicolo' Verrini On

First of all I can't give comments
Your code works. There's no error.
What you can try to do is to try to override THE $-FUNCTION.

Just try to add to your code
jQuery.noConflict();

And try...

  jQuery(document).ready(function(){
    jQuery('#search-field').focus(function() {
        if(jQuery(this).hasClass('placeHolder')){
            jQuery(this).val('');
            jQuery(this).removeClass('placeHolder');
            jQuery(this).addClass('search-field');
        }
    });
    jQuery('#search-field').blur(function() {
        if(jQuery(this).val() == '') {
            jQuery(this).val('Search');
            jQuery(this).addClass('placeHolder');
        }
    });
});


If you're using any other js framework or plugin. This can help.

Cheers