aboutsummaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/access.js5
-rw-r--r--src/core/toType.js20
2 files changed, 23 insertions, 2 deletions
diff --git a/src/core/access.js b/src/core/access.js
index 2e1eb4121..842c4a42b 100644
--- a/src/core/access.js
+++ b/src/core/access.js
@@ -1,7 +1,8 @@
define( [
"../core",
+ "../core/toType",
"../var/isFunction"
-], function( jQuery, isFunction ) {
+], function( jQuery, toType, isFunction ) {
"use strict";
@@ -13,7 +14,7 @@ var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
bulk = key == null;
// Sets many values
- if ( jQuery.type( key ) === "object" ) {
+ if ( toType( key ) === "object" ) {
chainable = true;
for ( i in key ) {
access( elems, fn, i, key[ i ], true, emptyGet, raw );
diff --git a/src/core/toType.js b/src/core/toType.js
new file mode 100644
index 000000000..c77ba95ad
--- /dev/null
+++ b/src/core/toType.js
@@ -0,0 +1,20 @@
+define( [
+ "../var/class2type",
+ "../var/toString"
+], function( class2type, toString ) {
+
+"use strict";
+
+function toType( obj ) {
+ if ( obj == null ) {
+ return obj + "";
+ }
+
+ // Support: Android <=2.3 only (functionish RegExp)
+ return typeof obj === "object" || typeof obj === "function" ?
+ class2type[ toString.call( obj ) ] || "object" :
+ typeof obj;
+}
+
+return toType;
+} );