1
- var _ = require ( '../../util' )
2
- var prefixes = [ '-webkit-' , '-moz-' , '-ms-' ]
3
- var camelPrefixes = [ 'Webkit' , 'Moz' , 'ms' ]
4
- var importantRE = / ! i m p o r t a n t ; ? $ /
5
- var testEl = null
6
- var propCache = { }
1
+ import {
2
+ extend ,
3
+ isArray ,
4
+ hyphenate ,
5
+ camelize
6
+ } from '../../util'
7
7
8
- module . exports = {
8
+ const prefixes = [ '-webkit-' , '-moz-' , '-ms-' ]
9
+ const camelPrefixes = [ 'Webkit' , 'Moz' , 'ms' ]
10
+ const importantRE = / ! i m p o r t a n t ; ? $ /
11
+ const propCache = Object . create ( null )
12
+
13
+ let testEl = null
14
+
15
+ export default {
9
16
10
17
deep : true ,
11
18
12
- update : function ( value ) {
19
+ update ( value ) {
13
20
if ( typeof value === 'string' ) {
14
21
this . el . style . cssText = value
15
- } else if ( _ . isArray ( value ) ) {
16
- this . handleObject ( value . reduce ( _ . extend , { } ) )
22
+ } else if ( isArray ( value ) ) {
23
+ this . handleObject ( value . reduce ( extend , { } ) )
17
24
} else {
18
25
this . handleObject ( value || { } )
19
26
}
20
27
} ,
21
28
22
- handleObject : function ( value ) {
29
+ handleObject ( value ) {
23
30
// cache object styles so that only changed props
24
31
// are actually updated.
25
32
var cache = this . cache || ( this . cache = { } )
@@ -39,7 +46,7 @@ module.exports = {
39
46
}
40
47
} ,
41
48
42
- handleSingle : function ( prop , value ) {
49
+ handleSingle ( prop , value ) {
43
50
prop = normalize ( prop )
44
51
if ( ! prop ) return // unsupported prop
45
52
// cast possible numbers/booleans into strings
@@ -87,8 +94,8 @@ function normalize (prop) {
87
94
*/
88
95
89
96
function prefix ( prop ) {
90
- prop = _ . hyphenate ( prop )
91
- var camel = _ . camelize ( prop )
97
+ prop = hyphenate ( prop )
98
+ var camel = camelize ( prop )
92
99
var upper = camel . charAt ( 0 ) . toUpperCase ( ) + camel . slice ( 1 )
93
100
if ( ! testEl ) {
94
101
testEl = document . createElement ( 'div' )
0 commit comments