Made some code tweaks related to running jQuery through JSLint (thanks to Lorin Larso...
[jquery.git] / src / core.js
index 02d8269..e2e60a9 100644 (file)
@@ -480,6 +480,9 @@ jQuery.extend({
                if ( typeof data !== "string" || !data ) {
                        return null;
                }
+
+               // Make sure leading/trailing whitespace is removed (IE can't handle it)
+               data = jQuery.trim( data );
                
                // Make sure the incoming data is actual JSON
                // Logic borrowed from http://json.org/json2.js
@@ -690,7 +693,7 @@ jQuery.extend({
                        /(opera)(?:.*version)?[ \/]([\w.]+)/.exec( ua ) ||
                        /(msie) ([\w.]+)/.exec( ua ) ||
                        !/compatible/.test( ua ) && /(mozilla)(?:.*? rv:([\w.]+))?/.exec( ua ) ||
-                       [];
+                       [];
 
                return { browser: match[1] || "", version: match[2] || "0" };
        },
@@ -796,7 +799,7 @@ function access( elems, key, value, exec, fn, pass ) {
        }
        
        // Getting an attribute
-       return length ? fn( elems[0], key ) : null;
+       return length ? fn( elems[0], key ) : undefined;
 }
 
 function now() {