views:

233

answers:

2

I keep getting this error all over the place where I only have jquery 1.3 or 1.4 included.

"setting a property that has only a getter"

and a long list of warnings in the Firefox Error Console.

What's going on? I can't find any information on this issue =/

<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
<head>
  <title>Demo</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 
    <link rel="shortcut icon" href="images/favicon.ico">
    <link rel="stylesheet" href="css/common.css" type="text/css" /> 
    <link rel="stylesheet" href="css/modules.css" type="text/css" /> 
    <script type="text/javascript" src="js/jquery-1.4.2.min.js"></script> 
</head>  

Just some Warning snippets:

Warning: reference to undefined property a[++e] 
Source File: /js/jquery-1.4.2.min.js 
Line: 30 
Warning: reference to undefined property a[0] 
Source File: /js/jquery-1.4.2.min.js 
Line: 30 
Warning: function oa does not always return a value 
Source File: /js/jquery-1.4.2.min.js Line: 18, Column: 165 
Source Code: th;n<r;n++){j=d[n];a.currentTarget=j.elem;a.data=j.handleObj.data;a.handleObj=j.handleObj;if(j.handleObj.origHandler.apply(j.elem,e)===false){b=false;break}}return b}}function pa(a,b){return"live."+(a&&a!=="*"?a+".":"")+b.replace(/\./g,"`").replace(/ /g,
+2  A: 

Do you have a "use strict"; statement anywhere? That causes ECMAScript5 browsers to parse JavaScript a little different and could cause this to be returned as an error.

You can remove this to fix the error, but that means you don't benefit from use strict. Note that use strict works in whatever scope it is executed in. So, if you want to load jQuery as non-strict, but have the rest of your code be strict, you can do this:

//load jQuery here

//create a scope
(function() {
     "use strict";
     // your code here
})();
EndangeredMassa
There are no browsers outside of the internet silly
zincorp
Eh.... Freudian slip -- I meant -- Out of interest, what browsers support ES5's "use strict" thingy?
J-P
The DOCTYPE is Strict. So I dont see how scoping to use strict works.
codeninja
This is a strict mode for JavaScript only. A strict doctype is only concerned with the HTML markup.
EndangeredMassa
But this doesnt happen in my code, it happens in the jQuery library.
codeninja
"ECMAScript5 browsers" - what browsers?
J-P
If you have "use strict"; in the global scope, it will affect jQuery.
EndangeredMassa
I believe the latest versions of all major browsers currently support at least pieces of the ECMAScript 5 standard. IE8, FF3.6+, Chrome, Safari, and Opera.
EndangeredMassa
This is an interesting to know, but I wonder how helpful it is to my problem.
codeninja
Are you using `"use strict";` in your code at all? If so, that might be the cause of your error and you can fix it by changing the scope. If not, then there is something else wrong. Or, are you saying that jQuery has "use strict"; and that's the cause of the error?
EndangeredMassa
There are no browsers that support "use strict" (http://kangax.github.com/es5-compat-table/). Thus "use strict" cannot be the issue.
Sean McMillan
Ah, I didn't realize that support was still pending.
EndangeredMassa
+2  A: 

Although this question has already been answered, I felt this was necessary.

OP probably has strict warnings turned on in his about:config in Firefox.

To change this just load up about:config in Firefox then scroll down to javascript.options.strict and then change this value to "false".

Dave B.
Actually... javascript.options.strict;false -- it was already set to false
codeninja