forked from brandonaaron/jquery-cssHooks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuserinterface.js
executable file
·64 lines (53 loc) · 1.47 KB
/
userinterface.js
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*!
* Copyright (c) 2011 Tom Ellis (http://www.webmuse.co.uk)
* User Interface cssHook for jQuery
* Limitations:
- Works with jQuery 1.4.3 and higher
- Works in Firefox 2+, Safari/Chrome (Partial support) only
* Licensed under the MIT License (LICENSE.txt).
*/
(function($) {
var div = document.createElement( "div" ),
divStyle = div.style,
propertyName = 'user',
suffix = 'User',
props = [
'Input',
'Modify',
'Select',
'Focus'
],
testProperties = [
propertyName,
'Moz' + suffix,
'Webkit' + suffix,
'O' + suffix,
'ms' + suffix
],
supportProperty,
j = props.length;
i = testProperties.length;
o:for( var a = 0; a < j; a++ ){
for( var b = 0; b < i; b++ ){
if( ( testProperties[b] + props[a] ) in divStyle ){
$.support[propertyName + props[a]] = ( testProperties[b] + props[a] );
//If property is found continue to next item in outer loop
continue o;
}
}
}
$.each( props, function( i, prop ){
$.cssProps[propertyName+prop] = $.support[propertyName+prop];
if ( $.support[propertyName+prop] && $.support[propertyName+prop] !== propertyName+prop ){
$.cssHooks[propertyName+prop] = {
get: function( elem, computed ) {
return ( computed ? $.css( elem, $.support[propertyName+prop] ) : elem.style[$.support[propertyName+prop]] );
},
set: function( elem, value ) {
elem.style[$.support[propertyName+prop]] = value;
}
};
}
});
div = divStyle = null;
})(jQuery);