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很相似,只是在类型上进行了一点简单的扩展,其实可以直接看源代码就可以看得懂的
最新推荐文章于 2018-11-21 00:41:37 发布