Replaced the rest of the x.constructor != String comparions with typeof (Thanks Kelvin)
authorJörn Zaefferer <joern.zaefferer@gmail.com>
Fri, 15 Dec 2006 08:20:46 +0000 (08:20 +0000)
committerJörn Zaefferer <joern.zaefferer@gmail.com>
Fri, 15 Dec 2006 08:20:46 +0000 (08:20 +0000)
src/jquery/jquery.js

index 177d86b..554726e 100644 (file)
@@ -390,7 +390,7 @@ jQuery.fn = jQuery.prototype = {
         */\r
        attr: function( key, value, type ) {\r
                // Check to see if we're setting style values\r
-               return key.constructor != String || value != undefined ?\r
+               return typeof key != "string" || value != undefined ?\r
                        this.each(function(){\r
                                // See if we're setting a hash of styles\r
                                if ( value == undefined )\r
@@ -1456,7 +1456,7 @@ jQuery.extend({
                // Set the correct context (if none is provided)\r
                context = context || document;\r
 \r
-               if ( t.constructor != String ) return [t];\r
+               if ( typeof t != "string" ) return [t];\r
 \r
                if ( !t.indexOf("//") ) {\r
                        context = context.documentElement;\r
@@ -1645,7 +1645,7 @@ jQuery.extend({
                        // Otherwise, find the expression to execute\r
                        else {\r
                                var f = jQuery.expr[m[1]];\r
-                               if ( f.constructor != String )\r
+                               if ( typeof f != "string" )\r
                                        f = jQuery.expr[m[1]][m[2]];\r
 \r
                                // Build a custom macro to enclose it\r