qodeninja
qodeninja

Reputation: 11266

When I include only the jQuery 1.4 Library, I get an exception, why?

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">
<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,

Upvotes: 3

Views: 946

Answers (2)

Dave B.
Dave B.

Reputation: 21

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".

Upvotes: 2

EndangeredMassa
EndangeredMassa

Reputation: 17528

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
})();

Upvotes: 2

Related Questions