码迷,mamicode.com
首页 > 编程语言 > 详细

ExtJs--14--Ext.typeOf() 与 javascript中的typeof很相似,只是在类型上进行了一点简单的扩展,其实可以直接看源代码就可以看得懂的

时间:2014-11-14 14:20:07      阅读:225      评论:0      收藏:0      [点我收藏+]

标签:extjs4   源码   ext.typeof   

	
	Ext.typeOf()
//	Ext.typeOf() 与 javascript中的typeof很相似,只是在类型上进行了一点简单的扩展,其实可以直接看源代码就可以看得懂的
//        typeOf: function(value) {
//            var type,
//                typeToString;
//            
//            if (value === null) {
//                return 'null';
//            }
//
//            type = typeof value;
//
//            if (type === 'undefined' || type === 'string' || type === 'number' || type === 'boolean') {
//                return type;
//            }
//
//            typeToString = toString.call(value);
//
//            switch(typeToString) {
//                case '[object Array]':
//                    return 'array';
//                case '[object Date]':
//                    return 'date';
//                case '[object Boolean]':
//                    return 'boolean';
//                case '[object Number]':
//                    return 'number';
//                case '[object RegExp]':
//                    return 'regexp';
//            }
//
//            if (type === 'function') {
//                return 'function';
//            }
//
//            if (type === 'object') {
//                if (value.nodeType !== undefined) {
//                    if (value.nodeType === 3) {
//                        return (/\S/).test(value.nodeValue) ? 'textnode' : 'whitespace';
//                    }
//                    else {
//                        return 'element';
//                    }
//                }
//
//                return 'object';
//            }
//
//            //<debug error>
//            Ext.Error.raise({
//                sourceClass: 'Ext',
//                sourceMethod: 'typeOf',
//                msg: 'Failed to determine the type of the specified value "' + value + '". This is most likely a bug.'
//            });
//            //</debug>
//        }
//Ext.typeOf() 和 Ext.type()的异同
//下面这是源码
//Ext.type = Ext.typeOf;

ExtJs--14--Ext.typeOf() 与 javascript中的typeof很相似,只是在类型上进行了一点简单的扩展,其实可以直接看源代码就可以看得懂的

标签:extjs4   源码   ext.typeof   

原文地址:http://blog.csdn.net/responsecool/article/details/41117353

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!