@@ -2,7 +2,6 @@ var _ = require('../../util')
22var prefixes = [ '-webkit-' , '-moz-' , '-ms-' ]
33var camelPrefixes = [ 'Webkit' , 'Moz' , 'ms' ]
44var importantRE = / ! i m p o r t a n t ; ? $ /
5- var camelRE = / ( [ a - z ] ) ( [ A - Z ] ) / g
65var testEl = null
76var propCache = { }
87
@@ -14,33 +13,33 @@ module.exports = {
1413 if ( typeof value === 'string' ) {
1514 this . el . style . cssText = value
1615 } else if ( _ . isArray ( value ) ) {
17- this . objectHandler ( value . reduce ( _ . extend , { } ) )
16+ this . handleObject ( value . reduce ( _ . extend , { } ) )
1817 } else {
19- this . objectHandler ( value )
18+ this . handleObject ( value || { } )
2019 }
2120 } ,
2221
23- objectHandler : function ( value ) {
22+ handleObject : function ( value ) {
2423 // cache object styles so that only changed props
2524 // are actually updated.
2625 var cache = this . cache || ( this . cache = { } )
27- var prop , val
28- for ( prop in cache ) {
29- if ( ! ( prop in value ) ) {
30- this . setProp ( prop , null )
31- delete cache [ prop ]
26+ var name , val
27+ for ( name in cache ) {
28+ if ( ! ( name in value ) ) {
29+ this . handleSingle ( name , null )
30+ delete cache [ name ]
3231 }
3332 }
34- for ( prop in value ) {
35- val = value [ prop ]
36- if ( val !== cache [ prop ] ) {
37- cache [ prop ] = val
38- this . setProp ( prop , val )
33+ for ( name in value ) {
34+ val = value [ name ]
35+ if ( val !== cache [ name ] ) {
36+ cache [ name ] = val
37+ this . handleSingle ( name , val )
3938 }
4039 }
4140 } ,
4241
43- setProp : function ( prop , value ) {
42+ handleSingle : function ( prop , value ) {
4443 prop = normalize ( prop )
4544 if ( ! prop ) return // unsupported prop
4645 // cast possible numbers/booleans into strings
@@ -88,7 +87,7 @@ function normalize (prop) {
8887 */
8988
9089function prefix ( prop ) {
91- prop = prop . replace ( camelRE , '$1-$2' ) . toLowerCase ( )
90+ prop = _ . hyphenate ( prop )
9291 var camel = _ . camelize ( prop )
9392 var upper = camel . charAt ( 0 ) . toUpperCase ( ) + camel . slice ( 1 )
9493 if ( ! testEl ) {
0 commit comments