jquery isType() 类型判断代码
2018-10-12 14:03
676 查看
class2type = {};
toString = Object.prototype.toString;
type: function( obj ) {
return obj == null ?
String( obj ) :
class2type[ toString.call(obj) ] || "object";
},
isFunction: function( obj ) {
return jQuery.type(obj) === "function";
},
isArray: Array.isArray || function( obj ) {
return jQuery.type(obj) === "array";
},
// A crude way of determining if an object is a window
isWindow: function( obj ) {
return obj && typeof obj === "object" && "setInterval" in obj;
},
isNaN: function( obj ) {
return obj == null || !rdigit.test( obj ) || isNaN( obj );
},
相关文章推荐
- jquery isType() 类型判断代码
- Flex的四种判断对象类型的方式 as instanceof is typeof比较
- jquery判断变量类型typeof和Object.prototype.toString.apply()
- 判断webpart类型 How can I tell what type a web part is?
- Flex进行数据类型判断:is typeof ObjectUtil.getClassInfo
- jquery判断类型是不是number类型的实例代码
- jquery源码之属性判断-$.type类型
- jQuery源码分析之数据类型判断方法——$.type()
- jQuery1.6 类型判断实现代码
- jQuery1.6 类型判断实现代码
- Jquery判断用户执行的事件类型:event.type
- jquery判断浏览器类型的代码
- python不使用type(obj) is **来判断变量的类型
- jquery判断浏览器类型的代码
- jQuery 1.6 源码学习(五)——core.js[5]之类型判断方法type
- jquery $.type来实现类型判断,更准备
- jquery判断浏览器类型的代码
- jQuery 类型判断实现代码
- The method isEmpty() is undefined for the type String/String类型的isEmpty报错