-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbelt.js
More file actions
45 lines (39 loc) · 1.32 KB
/
belt.js
File metadata and controls
45 lines (39 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
belt = (function(){
'use strict';
var string2type = {
'[object Boolean]': 'boolean',
'[object Number]': 'number',
'[object String]': 'string',
'[object Function]': 'function',
'[object Array]': 'array',
'[object Date]': 'date',
'[object RegExp]': 'regexp',
'[object Object]': 'object',
'[object Error]': 'error'
},
belt = {
typeof: function( obj ) {
if ( obj === null ) {
return obj + '';
}
// Support: Android < 4.0, iOS < 6 (functionish RegExp)
return typeof obj === 'object' || typeof obj === 'function' ?
string2type[ toString.call(obj) ] || 'object' :
typeof obj;
}
, isDefaultPrevented: function (eventIn) {
//this is a fix for versions of android.
// use it in your event handling to check for error filled
// bubbling of events.
if ( eventIn.defaultPrevented ||
// Support: Android < 4.0
eventIn.defaultPrevented === undefined &&
eventIn.getPreventDefault && eventIn.getPreventDefault() ) {
return true;
} else {
return false;
}
}
};
return belt;
})();